]> granicus.if.org Git - strace/commitdiff
2003-11-11 Roland McGrath <roland@redhat.com>
authorRoland McGrath <roland@redhat.com>
Tue, 11 Nov 2003 21:24:23 +0000 (21:24 +0000)
committerRoland McGrath <roland@redhat.com>
Tue, 11 Nov 2003 21:24:23 +0000 (21:24 +0000)
* strace.c (main): Bail with usage error for missing command before we
open the -o file or fiddle uids.

strace.c

index 1d057fcd6201c869b2ad74016e977af363560de5..fea2a13b802a139deb4776c0c3d2543d1b7b58cf 100644 (file)
--- a/strace.c
+++ b/strace.c
@@ -304,6 +304,9 @@ char *argv[];
                }
        }
 
+       if (optind == argc && !pflag_seen)
+               usage(stderr, 1);
+
        /* See if they want to run as another user. */
        if (username != NULL) {
                struct passwd *pent;
@@ -408,7 +411,7 @@ char *argv[];
                                pid);
        }
 
-       if (optind < argc) {
+       if (!pflag_seen) {
                struct stat statbuf;
                char *filename;
                char pathname[MAXPATHLEN];
@@ -549,8 +552,6 @@ char *argv[];
                        break;
                }
        }
-       else if (pflag_seen == 0)
-               usage(stderr, 1);
 
        sigemptyset(&empty_set);
        sigemptyset(&blocked_set);