[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdeextragear-3/kdebluetooth/libqobex/qobex
From:       Tobias Koenig <tokoe () kde ! org>
Date:       2005-02-10 19:20:43
Message-ID: 20050210192043.4830A1BAD2 () office ! kde ! org
[Download RAW message or body]

CVS commit by tokoe: 

Such a complicated algorithm and it still didn't work... the simple
access(2) does the same job, just a bit better ;)


  M +1 -20     qttylock.cpp   1.6


--- kdeextragear-3/kdebluetooth/libqobex/qobex/qttylock.cpp  #1.5:1.6
@@ -271,24 +271,5 @@ const char* QTTYLock::getLockDir() {
   // Get a writeble lock directory.
   for ( int i=0; lockDirs[i]; ++i ) {
-    struct stat sbuf;
-    if ( stat( QFile::encodeName( device ), &sbuf ) )
-      continue;
-    if ( !S_ISDIR( sbuf.st_mode ) )
-      continue;
-    if ( sbuf.st_mode & S_IWUSR && sbuf.st_uid == ::geteuid() )
-      return lockDirs[i];
-    if ( sbuf.st_mode & S_IWGRP ) {
-      if ( sbuf.st_gid == ::getegid() )
-        return lockDirs[i];
-      struct group *og = ::getgrgid( ::getegid() );
-      struct group *dg = ::getgrgid( sbuf.st_gid );
-      if ( !og && !dg )
-        continue;
-      for ( char **gn = dg->gr_mem; *gn; ++gn ) {
-        if ( ::strcmp(*gn, og->gr_name ) == 0 )
-          return lockDirs[i];
-      }
-    }
-    if ( sbuf.st_mode & S_IWOTH )
+    if ( access( lockDirs[i], R_OK|W_OK ) == 0 )
       return lockDirs[i];
   }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic