plug fd leak noticed by Russ Dill

-Erik
This commit is contained in:
Eric Andersen 2002-06-05 07:11:32 +00:00
parent 1fca558799
commit ff7661d9de
2 changed files with 2 additions and 0 deletions

View File

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

View File

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