#include "file.h"
#include <sys/stat.h>
+#ifdef HAVE_UTIME_H
#include <utime.h>
+#endif
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
// Save mtime for later use
struct stat stat_save;
if ( no_change_mtime )
- stat ( filename, &stat_save );
+ if ( stat ( filename, &stat_save ) != 0 )
+ g_warning ( "%s couldn't read: %s", __FUNCTION__, filename );
#ifdef HAVE_LIBGEXIV2
GExiv2Metadata *gemd = gexiv2_metadata_new ();
(void)stat ( filename, &stat_tmp );
utb.actime = stat_tmp.st_atime;
utb.modtime = stat_save.st_mtime;
- utime ( filename, &utb );
+ // Not security critical, thus potential Time of Check Time of Use race condition is not bad
+ // coverity[toctou]
+ if ( g_utime ( filename, &utb ) != 0 )
+ g_warning ( "%s couldn't set time on: %s", __FUNCTION__, filename );
}
return result;