summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@dtucker.net>2019-03-28 09:26:14 +1100
committerDarren Tucker <dtucker@dtucker.net>2019-03-28 09:26:14 +1100
commitf5abb05f8c7358dacdcb866fe2813f6d8efd5830 (patch)
tree317977c459ec648e9e21ce53eedda5305f16dadf
parent786cd4c1837fdc3fe7b4befe54a3f37db7df8715 (diff)
Only use O_NOFOLLOW in utimensat if defined.
Fixes build on systems that don't have it (Solaris <=9) Found by Tom G. Christensen.
-rw-r--r--openbsd-compat/bsd-misc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c
index d3a41df5..3c85a12a 100644
--- a/openbsd-compat/bsd-misc.c
+++ b/openbsd-compat/bsd-misc.c
@@ -143,8 +143,10 @@ utimensat(int fd, const char *path, const struct timespec times[2],
# ifndef HAVE_FUTIMES
return utimes(path, tv);
# else
+# ifdef O_NOFOLLOW
if (flag & AT_SYMLINK_NOFOLLOW)
oflags |= O_NOFOLLOW;
+# endif /* O_NOFOLLOW */
if ((fd = open(path, oflags)) == -1)
return -1;
ret = futimes(fd, tv);