2003-11-11 Roland McGrath <roland@redhat.com>
* strace.c (main): Bail with usage error for missing command before we
open the -o file or fiddle uids.
diff --git a/strace.c b/strace.c
index 1d057fc..fea2a13 100644
--- a/strace.c
+++ b/strace.c
@@ -304,6 +304,9 @@
}
}
+ 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 @@
pid);
}
- if (optind < argc) {
+ if (!pflag_seen) {
struct stat statbuf;
char *filename;
char pathname[MAXPATHLEN];
@@ -549,8 +552,6 @@
break;
}
}
- else if (pflag_seen == 0)
- usage(stderr, 1);
sigemptyset(&empty_set);
sigemptyset(&blocked_set);