1
0
mirror of https://github.com/systemd/systemd.git synced 2025-08-11 13:49:51 +03:00

udevadm: don't hit an assert when obsolete parameters are passed

https://bugzilla.redhat.com/show_bug.cgi?id=1178051
This commit is contained in:
Lennart Poettering
2015-01-08 01:59:58 +01:00
parent 07289967bc
commit 2ac23519d0

View File

@ -48,12 +48,12 @@ static void help(void) {
static int adm_settle(struct udev *udev, int argc, char *argv[]) { static int adm_settle(struct udev *udev, int argc, char *argv[]) {
static const struct option options[] = { static const struct option options[] = {
{ "seq-start", required_argument, NULL, '\0' }, /* removed */
{ "seq-end", required_argument, NULL, '\0' }, /* removed */
{ "timeout", required_argument, NULL, 't' }, { "timeout", required_argument, NULL, 't' },
{ "exit-if-exists", required_argument, NULL, 'E' }, { "exit-if-exists", required_argument, NULL, 'E' },
{ "quiet", no_argument, NULL, 'q' }, /* removed */
{ "help", no_argument, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{ "seq-start", required_argument, NULL, 's' }, /* removed */
{ "seq-end", required_argument, NULL, 'e' }, /* removed */
{ "quiet", no_argument, NULL, 'q' }, /* removed */
{} {}
}; };
const char *exists = NULL; const char *exists = NULL;
@ -63,8 +63,9 @@ static int adm_settle(struct udev *udev, int argc, char *argv[]) {
struct udev_queue *queue; struct udev_queue *queue;
int rc = EXIT_FAILURE; int rc = EXIT_FAILURE;
while ((c = getopt_long(argc, argv, "s:e:t:E:qh", options, NULL)) >= 0) { while ((c = getopt_long(argc, argv, "t:E:hs:e:q", options, NULL)) >= 0) {
switch (c) { switch (c) {
case 't': { case 't': {
int r; int r;
@ -76,14 +77,24 @@ static int adm_settle(struct udev *udev, int argc, char *argv[]) {
}; };
break; break;
} }
case 'E': case 'E':
exists = optarg; exists = optarg;
break; break;
case 'h': case 'h':
help(); help();
return EXIT_SUCCESS; return EXIT_SUCCESS;
case 's':
case 'e':
case 'q':
log_info("Option -%c no longer supported.", c);
return EXIT_FAILURE;
case '?': case '?':
return EXIT_FAILURE; return EXIT_FAILURE;
default: default:
assert_not_reached("Unknown argument"); assert_not_reached("Unknown argument");
} }