From 0b1d79abf7abe44662466f3238dcbf59c6ec335a Mon Sep 17 00:00:00 2001 From: MIZUTA Takeshi Date: Oct 25 2019 15:53:00 +0000 Subject: sss_client/idmap/common_ex.c: fix sss_nss_timedlock() to return errno sss_nss_timedloc() should return errno, but returns -1 if clock_gettime(2) fails. Fix sss_nss_timedlock() to return errno if clock_gettime(2) fails. --- diff --git a/src/sss_client/idmap/common_ex.c b/src/sss_client/idmap/common_ex.c index e655bb8..1aa6c6f 100644 --- a/src/sss_client/idmap/common_ex.c +++ b/src/sss_client/idmap/common_ex.c @@ -73,7 +73,7 @@ int sss_nss_timedlock(unsigned int timeout_ms, int *time_left_ms) ret = clock_gettime(CLOCK_REALTIME, &starttime); if (ret != 0) { - return ret; + return errno; } endtime.tv_sec = starttime.tv_sec + SEC_FROM_MSEC(timeout_ms); endtime.tv_nsec = starttime.tv_nsec + NSEC_FROM_MSEC(timeout_ms); @@ -83,6 +83,7 @@ int sss_nss_timedlock(unsigned int timeout_ms, int *time_left_ms) if (ret == 0) { ret = clock_gettime(CLOCK_REALTIME, &endtime); if (ret != 0) { + ret = errno; sss_nss_unlock(); return ret; }