Skip to contentSkip to conversation

smokey: y2038: Fix up error codes

PATCH New Jan Kiszka 1 participant 1 message Dec 1

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH v2 1/1 smokey: y2038: Fix up error codes

From: Jan Kiszka <[email protected]>

clock_gettime is returning the error in errno, and pthread_mutex_unlock is using positive error codes. The caller expects -errno.

Fixes 037495e487b5 ("y2038: testsuite/smokey/y2038: Adding test cases for mutex_timedlock64()")

---

Changes in v2:
- fix typo in subject
- add fixes

 testsuite/smokey/y2038/syscall-tests.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
testsuite/smokey/y2038/syscall-tests.c +3 -3
index 49903cb3ad..35887aaa42 100644
@@ -429,7 +429,7 @@ static void *timedlock64_thread(void *arg)
 	int ret;
 
 	if (ctx->timedwait_timecheck) {
-		if (!__T(ret, clock_gettime(CLOCK_REALTIME, &ts_nat)))
+		if (!__Terrno(ret, clock_gettime(CLOCK_REALTIME, &ts_nat)))
 			return (void *)(long)ret;
 
 		t1.tv_sec = ts_nat.tv_sec;
@@ -443,7 +443,7 @@ static void *timedlock64_thread(void *arg)
 		return (void *)(long)ret;
 
 	if (ctx->timedwait_timecheck) {
-		if (!__T(ret, clock_gettime(CLOCK_REALTIME, &ts_nat)))
+		if (!__Terrno(ret, clock_gettime(CLOCK_REALTIME, &ts_nat)))
 			return (void *)(long)ret;
 
 		t2.tv_sec = ts_nat.tv_sec;
@@ -457,7 +457,7 @@ static void *timedlock64_thread(void *arg)
 				       t2.tv_nsec);
 	}
 
-	return (void *)(long)pthread_mutex_unlock(ctx->mutex);
+	return (void *)(long)-pthread_mutex_unlock(ctx->mutex);
 }
 
 static int test_sc_cobalt_mutex_timedlock64(void)
Signature · 1 line
2.47.3