diff options
-rw-r--r-- | schedutils/ionice.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/schedutils/ionice.c b/schedutils/ionice.c index f5f53a33a..a1bf31fd2 100644 --- a/schedutils/ionice.c +++ b/schedutils/ionice.c @@ -152,6 +152,11 @@ int main(int argc, char *argv[]) } } + if (!set && !pid && optind == argc) + errx(EXIT_FAILURE, _("PID or COMMAND not specified")); + if (!set && !pid) + errx(EXIT_FAILURE, _("scheduling for the COMMAND not specified")); + switch (ioclass) { case IOPRIO_CLASS_NONE: if (set & 1) @@ -185,8 +190,7 @@ int main(int argc, char *argv[]) pid = strtol_or_err(argv[optind], _("failed to parse pid")); ioprio_setpid(pid, ioclass, data); } - } - else if (argv[optind]) { + } else if (argv[optind]) { ioprio_setpid(0, ioclass, data); execvp(argv[optind], &argv[optind]); /* execvp should never return */ |