diff options
author | Kay Sievers <kay.sievers@suse.de> | 2005-08-22 12:01:55 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@suse.de> | 2005-08-22 12:01:55 +0200 |
commit | 9bbcdb56d8221e2e839a2cf03fc071952fe7bc3c (patch) | |
tree | 44064500a782425e2aed6dcd3ba9dccf3c776ee1 /udevmonitor.c | |
parent | 66691c6e6c22820f645e3e1e104a9b5178031d3b (diff) |
fix exit code of udevinitsend and udevmonitor
Thanks to: Marco d'Itri <md@Linux.IT> for the initial patch.
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Diffstat (limited to 'udevmonitor.c')
-rw-r--r-- | udevmonitor.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/udevmonitor.c b/udevmonitor.c index 2775b295ce..9fe6da906f 100644 --- a/udevmonitor.c +++ b/udevmonitor.c @@ -63,6 +63,7 @@ static int init_udev_monitor_socket(void) if (retval < 0) { fprintf(stderr, "bind failed, %s\n", strerror(errno)); close(udev_monitor_sock); + udev_monitor_sock = -1; return -1; } @@ -125,13 +126,15 @@ int main(int argc, char *argv[]) if (getuid() != 0) { fprintf(stderr, "need to be root, exit\n\n"); - exit(1); + exit(2); } retval = init_udev_monitor_socket(); if (retval) goto out; - init_uevent_netlink_sock(); + retval = init_uevent_netlink_sock(); + if (retval) + goto out; printf("udevmonitor prints the received event from the kernel [UEVENT]\n" "and the event which udev sends out after rule processing [UDEV]\n\n"); @@ -204,5 +207,7 @@ out: if (udev_monitor_sock > 0) close(udev_monitor_sock); - return retval; + if (retval) + return 3; + return 0; } |