]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
timeout: fixup previous warning fix
authorPádraig Brady <P@draigBrady.com>
Thu, 1 Sep 2011 14:50:08 +0000 (15:50 +0100)
committerPádraig Brady <P@draigBrady.com>
Thu, 1 Sep 2011 14:50:08 +0000 (15:50 +0100)
* src/timeout.c (settimeout): Fix the previous commit
to test errno rather than the return value.

src/timeout.c

index fd19d1266f27e9f1fdb8710b2ec1501eed21f57f..d734e4e81b932515f02981376b8bcbcfded2f703 100644 (file)
@@ -116,8 +116,7 @@ settimeout (double duration)
   struct timespec ts = dtotimespec (duration);
   struct itimerspec its = { {0, 0}, ts };
   timer_t timerid;
-  int timer_ret = timer_create (CLOCK_REALTIME, NULL, &timerid);
-  if (timer_ret == 0)
+  if (timer_create (CLOCK_REALTIME, NULL, &timerid) == 0)
     {
       if (timer_settime (timerid, 0, &its, NULL) == 0)
         return;
@@ -127,7 +126,7 @@ settimeout (double duration)
           timer_delete (timerid);
         }
     }
-  else if (timer_ret != ENOSYS)
+  else if (errno != ENOSYS)
     error (0, errno, _("warning: timer_create"));
 #endif