From: skeezix Date: Fri, 13 Jan 2012 04:51:55 +0000 (-0500) Subject: Slightly better locking, but mostly .. minimenu on first boot will pick up icons... X-Git-Tag: sz_beta3~10 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-libraries.git;a=commitdiff_plain;h=b641f303ffacc4445167c760c49230faa6f59be4 Slightly better locking, but mostly .. minimenu on first boot will pick up icons now, instead of ignoring most of them for being 'too new' --- diff --git a/apps/pndnotifyd.c b/apps/pndnotifyd.c index b8ce530..984371b 100644 --- a/apps/pndnotifyd.c +++ b/apps/pndnotifyd.c @@ -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 ); } diff --git a/lib/pnd_utility.c b/lib/pnd_utility.c index de2a2b7..b011cdd 100644 --- a/lib/pnd_utility.c +++ b/lib/pnd_utility.c @@ -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.. } diff --git a/minimenu/mmcache.c b/minimenu/mmcache.c index 9b0c8bc..73b2392 100644 --- a/minimenu/mmcache.c +++ b/minimenu/mmcache.c @@ -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 );