[PATCH 09/12] multipathd(coverity): check retval clock_gettime()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Checking this is pointless, as we'd bail out early in
pthread_cond_init_mono if CLOCK_MONOTONIC was unsupported, and this
is the only error condition of clock_gettime worth checking.
Do it anyway to make coverity feel better.

Signed-off-by: Martin Wilck <mwilck@xxxxxxxx>
---
 multipathd/main.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/multipathd/main.c b/multipathd/main.c
index 01cf70f..0270e18 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -242,10 +242,11 @@ int set_config_state(enum daemon_status state)
 		else if (running_state != DAEMON_IDLE) {
 			struct timespec ts;
 
-			clock_gettime(CLOCK_MONOTONIC, &ts);
-			ts.tv_sec += 1;
-			rc = pthread_cond_timedwait(&config_cond,
-						    &config_lock, &ts);
+			if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
+				ts.tv_sec += 1;
+				rc = pthread_cond_timedwait(&config_cond,
+							    &config_lock, &ts);
+			}
 		}
 		if (!rc && (running_state != DAEMON_SHUTDOWN)) {
 			running_state = state;
-- 
2.19.2

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel



[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux