chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4e93793
)
udevadm-trigger: add parameters checking
author
Yang Zhiyong
<yangzy.fnst@cn.fujitsu.com>
Sun, 3 Nov 2013 11:50:58 +0000
(19:50 +0800)
committer
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Thu, 7 Nov 2013 06:23:54 +0000
(
01:23
-0500)
src/udev/udevadm-trigger.c
patch
|
blob
|
history
diff --git
a/src/udev/udevadm-trigger.c
b/src/udev/udevadm-trigger.c
index f472996965ae68e51d911fa3cf14485f0522c342..d10ca59cca82333d0142e20be4f565f101510e16 100644
(file)
--- a/
src/udev/udevadm-trigger.c
+++ b/
src/udev/udevadm-trigger.c
@@
-32,6
+32,7
@@
#include <sys/un.h>
#include "udev.h"
#include <sys/un.h>
#include "udev.h"
+#include "util.h"
static int verbose;
static int dry_run;
static int verbose;
static int dry_run;
@@
-111,8
+112,14
@@
static int adm_trigger(struct udev *udev, int argc, char *argv[])
char buf[UTIL_PATH_SIZE];
option = getopt_long(argc, argv, "vng:o:t:hc:p:s:S:a:A:y:b:", options, NULL);
char buf[UTIL_PATH_SIZE];
option = getopt_long(argc, argv, "vng:o:t:hc:p:s:S:a:A:y:b:", options, NULL);
- if (option == -1)
+ if (option == -1) {
+ if (optind < argc) {
+ fprintf(stderr, "Extraneous argument: '%s'\n", argv[optind]);
+ rc = 1;
+ goto exit;
+ }
break;
break;
+ }
switch (option) {
case 'v':
switch (option) {
case 'v':
@@
-133,7
+140,13
@@
static int adm_trigger(struct udev *udev, int argc, char *argv[])
}
break;
case 'c':
}
break;
case 'c':
- action = optarg;
+ if (!nulstr_contains("add\0" "remove\0" "change\0", optarg)) {
+ log_error("unknown action '%s'\n", optarg);
+ rc = 2;
+ goto exit;
+ } else {
+ action = optarg;
+ }
break;
case 's':
udev_enumerate_add_match_subsystem(udev_enumerate, optarg);
break;
case 's':
udev_enumerate_add_match_subsystem(udev_enumerate, optarg);