chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mac: rename apis with mac_{selinux/smack}_ prefix
[elogind.git]
/
src
/
udev
/
udevadm-control.c
diff --git
a/src/udev/udevadm-control.c
b/src/udev/udevadm-control.c
index 00a909fc3171ed1c1a0af14b84bef65aa20ed1d9..6e3bc2ae98f3ddd0db5f1e738ecaa512011a1786 100644
(file)
--- a/
src/udev/udevadm-control.c
+++ b/
src/udev/udevadm-control.c
@@
-26,9
+26,9
@@
#include <sys/un.h>
#include "udev.h"
#include <sys/un.h>
#include "udev.h"
+#include "udev-util.h"
-static void print_help(void)
-{
+static void print_help(void) {
printf("Usage: udevadm control COMMAND\n"
" -e,--exit instruct the daemon to cleanup and exit\n"
" -l,--log-priority=LEVEL set the udev log level for the daemon\n"
printf("Usage: udevadm control COMMAND\n"
" -e,--exit instruct the daemon to cleanup and exit\n"
" -l,--log-priority=LEVEL set the udev log level for the daemon\n"
@@
-41,9
+41,8
@@
static void print_help(void)
" -h,--help print this help text\n\n");
}
" -h,--help print this help text\n\n");
}
-static int adm_control(struct udev *udev, int argc, char *argv[])
-{
- struct udev_ctrl *uctrl = NULL;
+static int adm_control(struct udev *udev, int argc, char *argv[]) {
+ _cleanup_udev_ctrl_unref_ struct udev_ctrl *uctrl = NULL;
int timeout = 60;
int rc = 1, c;
int timeout = 60;
int rc = 1, c;
@@
-85,7
+84,7
@@
static int adm_control(struct udev *udev, int argc, char *argv[])
i = util_log_priority(optarg);
if (i < 0) {
fprintf(stderr, "invalid number '%s'\n", optarg);
i = util_log_priority(optarg);
if (i < 0) {
fprintf(stderr, "invalid number '%s'\n", optarg);
-
goto out
;
+
return rc
;
}
if (udev_ctrl_send_set_log_level(uctrl, util_log_priority(optarg), timeout) < 0)
rc = 2;
}
if (udev_ctrl_send_set_log_level(uctrl, util_log_priority(optarg), timeout) < 0)
rc = 2;
@@
-114,7
+113,7
@@
static int adm_control(struct udev *udev, int argc, char *argv[])
case 'p':
if (strchr(optarg, '=') == NULL) {
fprintf(stderr, "expect <KEY>=<value> instead of '%s'\n", optarg);
case 'p':
if (strchr(optarg, '=') == NULL) {
fprintf(stderr, "expect <KEY>=<value> instead of '%s'\n", optarg);
-
goto out
;
+
return rc
;
}
if (udev_ctrl_send_set_env(uctrl, optarg, timeout) < 0)
rc = 2;
}
if (udev_ctrl_send_set_env(uctrl, optarg, timeout) < 0)
rc = 2;
@@
-128,7
+127,7
@@
static int adm_control(struct udev *udev, int argc, char *argv[])
i = strtoul(optarg, &endp, 0);
if (endp[0] != '\0' || i < 1) {
fprintf(stderr, "invalid number '%s'\n", optarg);
i = strtoul(optarg, &endp, 0);
if (endp[0] != '\0' || i < 1) {
fprintf(stderr, "invalid number '%s'\n", optarg);
-
goto out
;
+
return rc
;
}
if (udev_ctrl_send_set_children_max(uctrl, i, timeout) < 0)
rc = 2;
}
if (udev_ctrl_send_set_children_max(uctrl, i, timeout) < 0)
rc = 2;
@@
-156,8
+155,6
@@
static int adm_control(struct udev *udev, int argc, char *argv[])
fprintf(stderr, "Extraneous argument: %s\n", argv[optind]);
else if (optind == 1)
fprintf(stderr, "Option missing\n");
fprintf(stderr, "Extraneous argument: %s\n", argv[optind]);
else if (optind == 1)
fprintf(stderr, "Option missing\n");
-out:
- udev_ctrl_unref(uctrl);
return rc;
}
return rc;
}