plug fd leak noticed by Russ Dill
authorEric Andersen <andersen@codepoet.org>
Wed, 5 Jun 2002 07:11:32 +0000 (07:11 -0000)
committerEric Andersen <andersen@codepoet.org>
Wed, 5 Jun 2002 07:11:32 +0000 (07:11 -0000)
 -Erik

debianutils/start_stop_daemon.c
init/start_stop_daemon.c

index 29e3d86732ad72c855fe36a0ad3a7ca64c5d7137..6b090437f7cccee4a5bbfb0e0fd0a8d035f9c8af 100644 (file)
@@ -113,6 +113,7 @@ pid_is_exec(int pid, const char *exec)
        sprintf(buf, "/proc/%d/cmdline", pid);
        fp = fopen(buf, "r");
        if (fp && fgets (buf, sizeof (buf), fp) ) {
+               fclose(fp);
            if (strncmp (buf, exec, strlen(exec)) == 0)
                return 1;
        }
index 29e3d86732ad72c855fe36a0ad3a7ca64c5d7137..6b090437f7cccee4a5bbfb0e0fd0a8d035f9c8af 100644 (file)
@@ -113,6 +113,7 @@ pid_is_exec(int pid, const char *exec)
        sprintf(buf, "/proc/%d/cmdline", pid);
        fp = fopen(buf, "r");
        if (fp && fgets (buf, sizeof (buf), fp) ) {
+               fclose(fp);
            if (strncmp (buf, exec, strlen(exec)) == 0)
                return 1;
        }