Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 27 Dec 2020 18:41:54 +0000
From: Alexander Lobakin <alobakin@...me>
To: Rich Felker <dalias@...ifal.cx>, musl@...ts.openwall.com
Cc: Alexander Lobakin <alobakin@...me>
Subject: [PATCH 10/18] utimensat: prefer time64 variant if available

Instead of using time64 variant "only when needed", use it as
a default and fallback to time32 only on -ENOSYS.

Signed-off-by: Alexander Lobakin <alobakin@...me>
---
 src/stat/utimensat.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/stat/utimensat.c b/src/stat/utimensat.c
index 730723a9ea70..e3fda06faa01 100644
--- a/src/stat/utimensat.c
+++ b/src/stat/utimensat.c
@@ -13,7 +13,6 @@ int utimensat(int fd, const char *path, const struct timespec times[2], int flag
 	if (times && times[0].tv_nsec==UTIME_NOW && times[1].tv_nsec==UTIME_NOW)
 		times = 0;
 #ifdef SYS_utimensat_time64
-	r = -ENOSYS;
 	time_t s0=0, s1=0;
 	long ns0=0, ns1=0;
 	if (times) {
@@ -22,9 +21,8 @@ int utimensat(int fd, const char *path, const struct timespec times[2], int flag
 		if (!NS_SPECIAL(ns0)) s0 = times[0].tv_sec;
 		if (!NS_SPECIAL(ns1)) s1 = times[1].tv_sec;
 	}
-	if (SYS_utimensat == SYS_utimensat_time64 || !IS32BIT(s0) || !IS32BIT(s1))
-		r = __syscall(SYS_utimensat_time64, fd, path, times ?
-			((long long[]){s0, ns0, s1, ns1}) : 0, flags);
+	r = __syscall(SYS_utimensat_time64, fd, path, times ?
+		((long long[]){s0, ns0, s1, ns1}) : 0, flags);
 	if (SYS_utimensat == SYS_utimensat_time64 || r!=-ENOSYS)
 		return __syscall_ret(r);
 	if (!IS32BIT(s0) || !IS32BIT(s1))
-- 
2.29.2


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.