From: skeezix Date: Tue, 1 Feb 2011 19:01:39 +0000 (-0500) Subject: mmenu; just to be sure we dont' collide with pndnotifyd for this /tmp/iconcache scan X-Git-Tag: sz_beta3~94 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-libraries.git;a=commitdiff_plain;h=1829ef33b321c4666289dd0401864b01def9b024 mmenu; just to be sure we dont' collide with pndnotifyd for this /tmp/iconcache scan --- diff --git a/minimenu/mmcache.c b/minimenu/mmcache.c index 2cc9431..6816242 100644 --- a/minimenu/mmcache.c +++ b/minimenu/mmcache.c @@ -260,8 +260,9 @@ unsigned char cache_icon ( pnd_disco_t *app, unsigned char maxwidth, unsigned ch sprintf ( ovrfile, "%s/%s.png", iconpath, app -> unique_id ); + // making sure the file is at least a few seconds old, to help avoid race condition struct stat statbuf; - if ( stat ( ovrfile, &statbuf ) == 0 ) { + 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 );