Skip to content

glocalfileinfo: In set_mtime_atime(), don't use utimensat() if it's not available

Jared Wahlstrand requested to merge jwahlstrand/glib:utimensat2 into main

There are a lot of checks for HAVE_UTIMENSAT in this function, but one more is needed. This fixes the build on platforms that don't have utimensat().

[21:53:08] ../gio/glocalfileinfo.c:2803:9: error: implicit declaration of function 'utimensat' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
[21:53:08]   res = utimensat (AT_FDCWD, filename, times_n, 0);
[21:53:08]         ^
[21:53:08] ../gio/glocalfileinfo.c:2803:9: note: did you mean 'utimes'?
[21:53:08] /opt/x86_64-apple-darwin14/x86_64-apple-darwin14/sys-root/usr/include/sys/time.h:202:5: note: 'utimes' declared here
[21:53:08] int     utimes(const char *, const struct timeval *);
[21:53:08]         ^
[21:53:08] ../gio/glocalfileinfo.c:2803:40: error: use of undeclared identifier 'times_n'; did you mean 'times'?
[21:53:08]   res = utimensat (AT_FDCWD, filename, times_n, 0);
[21:53:08]                                        ^~~~~~~
[21:53:08]                                        times
[21:53:08] ../gio/glocalfileinfo.c:2698:18: note: 'times' declared here
[21:53:08]   struct timeval times[2] = { {0, 0}, {0, 0} };
[21:53:08]                  ^
[21:53:08] 2 errors generated.

Merge request reports