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:
Joachim Nilsson
2020-03-16 10:31:50 +01:00
parent e81ce85867
commit c716cc5835
+3 -1
View File
@@ -85,7 +85,9 @@ static void set_mtime(int in, int out)
struct stat st;
struct timespec tv[2];
fstat(in, &st);
if (fstat(in, &st))
return;
tv[0] = st.st_atim;
tv[1] = st.st_mtim;
futimens(out, tv);