git.openpandora.org
/
pandora-libraries.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1fafa16
)
mmenu; just to be sure we dont' collide with pndnotifyd for this /tmp/iconcache scan
author
skeezix
<skeezix@flotsam-vm.(none)>
Tue, 1 Feb 2011 19:01:39 +0000
(14:01 -0500)
committer
skeezix
<skeezix@flotsam-vm.(none)>
Tue, 1 Feb 2011 19:01:39 +0000
(14:01 -0500)
minimenu/mmcache.c
patch
|
blob
|
history
diff --git
a/minimenu/mmcache.c
b/minimenu/mmcache.c
index
2cc9431
..
6816242
100644
(file)
--- 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 );
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;
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 );
buflen = statbuf.st_size;
if ( ( iconbuf = malloc ( statbuf.st_size ) ) ) {
int fd = open ( ovrfile, O_RDONLY );