multipathd(coverity): check retval clock_gettime()
authorMartin Wilck <mwilck@suse.com>
Tue, 8 Jan 2019 22:54:06 +0000 (23:54 +0100)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Sat, 19 Jan 2019 10:51:35 +0000 (11:51 +0100)
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@suse.com>
multipathd/main.c

index c981d43..491832b 100644 (file)
@@ -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 = state;