From 00eac87ddaae7cef6ae05e25ff417e092ceab509 Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Fri, 5 Jan 2018 11:32:04 -0800 Subject: [lz4io] Refuse to set file stat for non-regular files --- programs/util.h | 6 ++++++ 1 file changed, 6 insertions(+) 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 */ -- cgit v0.12