mirror of
https://github.com/sheumann/hush.git
synced 2024-12-22 14:30:31 +00:00
plug fd leak noticed by Russ Dill
-Erik
This commit is contained in:
parent
1fca558799
commit
ff7661d9de
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user