[prev in list] [next in list] [prev in thread] [next in thread] 

List:       musl
Subject:    [musl] [PATCH 10/18] utimensat: prefer time64 variant if available
From:       Alexander Lobakin <alobakin () pm ! me>
Date:       2020-12-27 18:41:54
Message-ID: 20201227184032.22413-10-alobakin () pm ! me
[Download RAW message or body]

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@pm.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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic