]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
timeout: suppress a redundant warning on some systems
authorPádraig Brady <P@draigBrady.com>
Thu, 1 Sep 2011 14:30:18 +0000 (15:30 +0100)
committerPádraig Brady <P@draigBrady.com>
Thu, 1 Sep 2011 14:30:18 +0000 (15:30 +0100)
* src/timeout.c (settimeout): Don't warn about ENOSYS
which is returned on OpenBSD 4.9 at least.
Reported by Bruno Haible

src/timeout.c

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