[hackers] [sbase] time: errno is not guaranteed to be set for sysconf() || sin
commit cb0ef7feb2edd8cc1b87d34b3cdb7ffb97f4e2ca
Author: sin <sin_AT_2f30.org>
Date: Sat Feb 28 11:16:53 2015 +0000
time: errno is not guaranteed to be set for sysconf()
0 should be considered an invalid CLK_TCK.
diff --git a/time.c b/time.c
index a628021..e4be7b4 100644
--- a/time.c
+++ b/time.c
_AT_@ -25,8 +25,6 @@ main(int argc, char *argv[])
ARGBEGIN {
case 'p':
- /* used to specify POSIX output format, but that's the only format we
- * have for now */
break;
default:
usage();
_AT_@ -35,8 +33,8 @@ main(int argc, char *argv[])
if (!*argv)
usage();
- if ((ticks = sysconf(_SC_CLK_TCK)) < 0)
- eprintf("sysconf() failed to retrieve clock ticks per second:");
+ if ((ticks = sysconf(_SC_CLK_TCK)) <= 0)
+ eprintf("sysconf() failed to retrieve clock ticks per second\n");
if ((rbeg = times(&tms)) < 0)
eprintf("times() failed to retrieve start times:");
Received on Sat Feb 28 2015 - 15:42:54 CET
This archive was generated by hypermail 2.3.0
: Sat Feb 28 2015 - 15:48:20 CET