From 1829ef33b321c4666289dd0401864b01def9b024 Mon Sep 17 00:00:00 2001 From: skeezix Date: Tue, 1 Feb 2011 14:01:39 -0500 Subject: [PATCH] mmenu; just to be sure we dont' collide with pndnotifyd for this /tmp/iconcache scan --- minimenu/mmcache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 ); -- 2.39.2