$ ionice 123
none: prio 4
none: prio 4
It calls ioprio_get(0x1, 0) and ioprio_get(0x1, 123), because the
code does not check it the "-p" options was specified.
The proper command line syntax is:
$ ionice -p 123
and the ioprio_get() should be called only once.
Signed-off-by: Karel Zak <kzak@redhat.com>
}
}
+ 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)
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 */