]> Zhao Yanbai Git Server - minix.git/commitdiff
devmand call the cleanup method before doing an exit.
authorKees Jongenburger <kees.jongenburger@gmail.com>
Tue, 3 Jul 2012 14:42:08 +0000 (14:42 +0000)
committerKees Jongenburger <kees.jongenburger@gmail.com>
Thu, 5 Jul 2012 09:07:25 +0000 (11:07 +0200)
Call the cleanup mehtod before doing an exit to prevent stale pid
files.

commands/devmand/main.c

index 708142e41379f17e3ee4f559c493d182e2c2683d..0e831adc252a947f163dcb8918dab348dd6495fb 100644 (file)
@@ -510,6 +510,7 @@ static enum dev_type determine_type (char *path)
 
        if (mypath == NULL) {
                fprintf(stderr, "ERROR: out of mem\n");
+               cleanup();
                exit(1);
        }
 
@@ -862,7 +863,6 @@ static void main_loop()
        char ev_path[128];
        char buf[256];
        int len;
-
        FILE* fd;
        len = strlen(args.path);
 
@@ -872,6 +872,7 @@ static void main_loop()
 
        if (len > 128 - 7 /*len of "events" */) {
                fprintf(stderr, "pathname to long\n");
+               cleanup();
                exit(1);
        }
 
@@ -885,7 +886,9 @@ static void main_loop()
 
                fd = fopen(ev_path, "r");
                if (fd == NULL) {
-                       fprintf(stderr, "ERROR: could not open event file...\n");
+                       fprintf(stderr,"devmand error: could not open event "
+                               "file %s bailing out\n", ev_path);
+                       cleanup();
                        exit(1);
                }