The flags don't need to be global, and there are more obvious
ways to zero a variable.

While here, order the stack structures and variables by size.

--
Scott Cheloha

Index: usr.bin/time/time.c
===================================================================
RCS file: /cvs/src/usr.bin/time/time.c,v
retrieving revision 1.22
diff -u -p -r1.22 time.c
--- usr.bin/time/time.c 13 Jul 2017 06:39:54 -0000      1.22
+++ usr.bin/time/time.c 14 Jul 2017 00:10:09 -0000
@@ -42,19 +42,17 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-int lflag;
-int portableflag;
-
 __dead void usage(void);
 
 int
 main(int argc, char *argv[])
 {
-       pid_t pid;
-       int ch, status;
-       struct timespec before, after, during;
        struct rusage ru;
-       int exitonsig = 0;
+       struct timespec before, after, during;
+       pid_t pid;
+       int ch, exitonsig, lflag, portableflag, status;
+
+       exitonsig = lflag = portableflag = 0;
 
        if (pledge("stdio proc exec", NULL) == -1)
                err(1, "pledge");

Reply via email to