sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit d083a94731fbcd638218b86446575b46c569234c
parent 65ae4afa7c1a083d7f2aa1970590745a488c9194
Author: sin <sin@2f30.org>
Date:   Sat, 28 Feb 2015 11:16:53 +0000

time: errno is not guaranteed to be set for sysconf()

0 should be considered an invalid CLK_TCK.

Diffstat:
Mtime.c | 6++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/time.c b/time.c @@ -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(); @@ -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:");