mirror of
https://github.com/troglobit/libite.git
synced 2026-11-02 13:10:33 +00:00
copyfile(): Check return value of fstat(), prevent faulty futimens()
Found by Coverity Scan Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
e81ce85867
commit
c716cc5835
1 file changed
+3
-1
+3
-1
@@ -85,7 +85,9 @@ static void set_mtime(int in, int out)
|
|||||||
struct stat st;
|
struct stat st;
|
||||||
struct timespec tv[2];
|
struct timespec tv[2];
|
||||||
|
|
||||||
fstat(in, &st);
|
if (fstat(in, &st))
|
||||||
|
return;
|
||||||
|
|
||||||
tv[0] = st.st_atim;
|
tv[0] = st.st_atim;
|
||||||
tv[1] = st.st_mtim;
|
tv[1] = st.st_mtim;
|
||||||
futimens(out, tv);
|
futimens(out, tv);
|
||||||
|
|||||||
Reference in new issue
Block a user