Changeset 109
- Timestamp:
- 02/05/06 09:23:32 (3 years ago)
- Files:
-
- fastphoto/trunk/src/cache.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
fastphoto/trunk/src/cache.c
r108 r109 45 45 46 46 static int 47 cache_check (fastphoto_t * params, char * cachefile)47 file_check (char * filename, time_t * mtime) 48 48 { 49 49 struct stat statbuf; 50 50 51 if (stat ( cachefile, &statbuf) == -1) {51 if (stat (filename, &statbuf) == -1) { 52 52 switch (errno) { 53 53 case ENOENT: 54 54 return 0; 55 55 default: 56 fprintf (stderr, "fastphoto: Error checking %s ; %s\n", cachefile, strerror (errno));56 fprintf (stderr, "fastphoto: Error checking %s: %s\n", filename, strerror (errno)); 57 57 return -1; 58 58 } 59 } 60 61 *mtime = statbuf.st_mtime; 62 63 return 1; 64 } 65 66 static int 67 cache_check (fastphoto_t * params, char * cachefile) 68 { 69 time_t orig_mtime, cache_mtime; 70 int ret; 71 72 if ((ret = file_check (cachefile, &cache_mtime)) != 1) { 73 return ret; 74 } 75 76 if ((ret = file_check (params->infile, &orig_mtime)) != 1) { 77 return ret; 78 } 79 80 if (orig_mtime > cache_mtime) { 81 fprintf (stderr, "fastphoto: Removing stale cachefile %s\n", cachefile); 82 unlink (cachefile); 83 return 0; 59 84 } 60 85
