summaryrefslogtreecommitdiff
path: root/udevinitsend.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2005-08-22 12:01:55 +0200
committerKay Sievers <kay.sievers@suse.de>2005-08-22 12:01:55 +0200
commit9bbcdb56d8221e2e839a2cf03fc071952fe7bc3c (patch)
tree44064500a782425e2aed6dcd3ba9dccf3c776ee1 /udevinitsend.c
parent66691c6e6c22820f645e3e1e104a9b5178031d3b (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 'udevinitsend.c')
-rw-r--r--udevinitsend.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/udevinitsend.c b/udevinitsend.c
index 5abf3d4bd3..ea05734a00 100644
--- a/udevinitsend.c
+++ b/udevinitsend.c
@@ -128,7 +128,6 @@ static int udevsend(char *filename, int sock, int disable_loop_detection)
}
if (ch < le) {
-
strncpy(&usend_msg.envbuf[bufpos],ls,(ch - ls) + 1);
bufpos += (ch - ls) + 1;
if (ch[1] == '\'' && le[-1] == '\'') {
@@ -153,9 +152,10 @@ loop_end:
retval = sendto(sock, &usend_msg, usend_msg_len, 0, (struct sockaddr *)&saddr, addrlen);
if (retval < 0) {
dbg("error sending message (%s)", strerror(errno));
+ retval = -1;
}
}
-
+
return retval;
}
@@ -167,7 +167,7 @@ int main(int argc, char *argv[], char *envp[])
char *event_file = NULL;
DIR *dirstream;
struct dirent *direntry;
- int retval = 1;
+ int retval = 0;
int disable_loop_detection = 0;
int sock;
const char *env;
@@ -218,7 +218,7 @@ int main(int argc, char *argv[], char *envp[])
if (!dirstream) {
info("error opening directory %s: %s\n",
event_dir, strerror(errno));
- return 1;
+ return 2;
}
chdir(event_dir);
while ((direntry = readdir(dirstream)) != NULL) {
@@ -235,5 +235,7 @@ int main(int argc, char *argv[], char *envp[])
if (sock != -1)
close(sock);
- return retval;
+ if (retval)
+ return 3;
+ return 0;
}