diff options
author | Nick Terrell <terrelln@fb.com> | 2018-01-05 19:32:04 (GMT) |
---|---|---|
committer | Nick Terrell <terrelln@fb.com> | 2018-01-05 19:54:35 (GMT) |
commit | 00eac87ddaae7cef6ae05e25ff417e092ceab509 (patch) | |
tree | 8f95b6b3b7380f28ccd82af7291c00a302bd6ee9 | |
parent | 9474b706a511882c96c17306c02130b6718f2a09 (diff) | |
download | lz4-00eac87ddaae7cef6ae05e25ff417e092ceab509.zip lz4-00eac87ddaae7cef6ae05e25ff417e092ceab509.tar.gz lz4-00eac87ddaae7cef6ae05e25ff417e092ceab509.tar.bz2 |
[lz4io] Refuse to set file stat for non-regular files
-rw-r--r-- | programs/util.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/programs/util.h b/programs/util.h index 1382cab..fc7f63e 100644 --- a/programs/util.h +++ b/programs/util.h @@ -265,11 +265,17 @@ UTIL_STATIC void UTIL_waitForNextTick(void) #endif +UTIL_STATIC int UTIL_isRegFile(const char* infilename); + + UTIL_STATIC int UTIL_setFileStat(const char *filename, stat_t *statbuf) { int res = 0; struct utimbuf timebuf; + if (!UTIL_isRegFile(filename)) + return -1; + timebuf.actime = time(NULL); timebuf.modtime = statbuf->st_mtime; res += utime(filename, &timebuf); /* set access and modification times */ |