Slightly better locking, but mostly .. minimenu on first boot will pick up icons...
authorskeezix <skeezix@flotsam-vm.(none)>
Fri, 13 Jan 2012 04:51:55 +0000 (23:51 -0500)
committerskeezix <skeezix@flotsam-vm.(none)>
Fri, 13 Jan 2012 04:51:55 +0000 (23:51 -0500)
apps/pndnotifyd.c
lib/pnd_utility.c
minimenu/mmcache.c

index b8ce530..984371b 100644 (file)
@@ -316,6 +316,13 @@ int main ( int argc, char *argv[] ) {
       /* run the discovery
        */
 
+      // do some 'locking'
+      pnd_log ( pndn_rem, "creating lockfile %s", PNDLOCKNAME );
+      if ( ! pnd_lock ( PNDLOCKNAME ) ) {
+       // problem .. well, too bad, we need to do this .. proceed!
+      }
+
+      // scan..
       pnd_log ( pndn_rem, "  Scanning desktop paths----------------------------\n" );
       if ( ! perform_discoveries ( desktop_appspath, overridespath, desktop_dotdesktoppath, desktop_iconpath ) ) {
        pnd_log ( pndn_rem, "    No applications found in desktop search path\n" );
@@ -328,6 +335,10 @@ int main ( int argc, char *argv[] ) {
        }
       }
 
+      // unlock
+      pnd_log ( pndn_rem, "clearing lockfile %s", PNDLOCKNAME );
+      pnd_unlock ( PNDLOCKNAME );
+
       // if we've got a hup script located, lets invoke it
       if ( pndhup ) {
        pnd_log ( pndn_rem, "Invoking hup script '%s'.\n", pndhup );
@@ -816,13 +827,6 @@ unsigned char perform_discoveries ( char *appspath, char *overridespath,
   pnd_log ( pndn_rem, "perform discovery - apps: %s, overrides: %s\n", appspath, overridespath );
   pnd_log ( pndn_rem, "                  - emit desktop: %s, icons: %s\n", emitdesktoppath, emiticonpath );
 
-  // do some 'locking'
-  pnd_log ( pndn_rem, "creating lockfile %s", PNDLOCKNAME );
-
-  if ( ! pnd_lock ( PNDLOCKNAME ) ) {
-    // problem .. well, too bad, we need to do this .. proceed!
-  }
-
   // attempt to auto-discover applications in the given path
   applist = pnd_disco_search ( appspath, overridespath );
 
@@ -915,9 +919,5 @@ unsigned char perform_discoveries ( char *appspath, char *overridespath,
     pnd_box_delete ( applist ); // does not free the disco_t contents!
   }
 
-  // close the lock
-  pnd_log ( pndn_rem, "clearing lockfile %s", PNDLOCKNAME );
-  pnd_unlock ( PNDLOCKNAME );
-
   return ( 1 );
 }
index de2a2b7..b011cdd 100644 (file)
@@ -375,7 +375,7 @@ unsigned char pnd_lock ( char *lockname ) {
 
   snprintf ( fullpath, PATH_MAX, "%s/%s", PND_LOCK_PATH, lockname );
 
-  if ( ( fd = creat ( fullpath, 0400 ) < 0 ) ) {
+  if ( ( fd = creat ( fullpath, 0444 ) < 0 ) ) {
     return ( 0 ); // error, yeah, I know, no way to know why it failed..
   }
 
index 9b0c8bc..73b2392 100644 (file)
@@ -263,7 +263,8 @@ unsigned char cache_icon ( pnd_disco_t *app, unsigned char maxwidth, unsigned ch
 
     // making sure the file is at least a few seconds old, to help avoid race condition
     struct stat statbuf;
-    if ( stat ( ovrfile, &statbuf ) == 0 && time ( NULL ) - statbuf.st_mtime > 5 ) { // race with pndnotifyd
+    // *** commented out this stat() 'race test' since it buggers up icon loading at boot, if using .desktop instead of .pnd scanning..
+    if ( stat ( ovrfile, &statbuf ) == 0 /*&& time ( NULL ) - statbuf.st_mtime > 5*/ ) { // race with pndnotifyd
       buflen = statbuf.st_size;
       if ( ( iconbuf = malloc ( statbuf.st_size ) ) ) {
        int fd = open ( ovrfile, O_RDONLY );