diff options
-rw-r--r-- | src/udev/udev-builtin.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/udev/udev-builtin.c b/src/udev/udev-builtin.c index 88d1acf168..3ebefa84e2 100644 --- a/src/udev/udev-builtin.c +++ b/src/udev/udev-builtin.c @@ -89,10 +89,16 @@ void udev_builtin_list(struct udev *udev) { } const char *udev_builtin_name(enum udev_builtin_cmd cmd) { + if (!builtins[cmd]) + return NULL; + return builtins[cmd]->name; } bool udev_builtin_run_once(enum udev_builtin_cmd cmd) { + if (!builtins[cmd]) + return -EOPNOTSUPP; + return builtins[cmd]->run_once; } @@ -116,6 +122,9 @@ int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, const c int argc; char *argv[128]; + if (!builtins[cmd]) + return -EOPNOTSUPP; + /* we need '0' here to reset the internal state */ optind = 0; strscpy(arg, sizeof(arg), command); |