diff options
Diffstat (limited to 'sfeed_frames.c')
-rw-r--r-- | sfeed_frames.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/sfeed_frames.c b/sfeed_frames.c index 1994ba8..8e374b4 100644 --- a/sfeed_frames.c +++ b/sfeed_frames.c @@ -37,6 +37,7 @@ cleanup(void) fpcontent = NULL; } +/* same as err() but first call cleanup() function */ static void xerr(int eval, const char *fmt, ...) { @@ -113,6 +114,7 @@ main(int argc, char *argv[]) size_t linesize = 0, namelen, basepathlen; struct stat st; struct utimbuf contenttime; + int r; memset(&contenttime, 0, sizeof(contenttime)); @@ -221,16 +223,16 @@ main(int argc, char *argv[]) } /* write item. */ - errno = 0; - parsedtime = (time_t)strtol(fields[FieldUnixTimestamp], NULL, 10); - if(errno != 0) - parsedtime = 0; + r = strtotime(fields[FieldUnixTimestamp], &parsedtime); + /* set modified and access time of file to time of item. */ - contenttime.actime = parsedtime; - contenttime.modtime = parsedtime; - utime(filepath, &contenttime); + if(r != -1) { + contenttime.actime = parsedtime; + contenttime.modtime = parsedtime; + utime(filepath, &contenttime); + } - isnew = (parsedtime >= comparetime) ? 1 : 0; + isnew = (r != -1 && parsedtime >= comparetime) ? 1 : 0; totalnew += isnew; fcur->totalnew += isnew; fcur->total++; |