fiser: opendir "/proc", not "." (by Cristian Ionescu-Idbohrn)
This commit is contained in:
parent
ea9f7a6a7f
commit
5de8a13b08
@ -208,6 +208,7 @@ static pid_list *scan_dir_links(const char *dname, pid_t pid,
|
|||||||
return plist;
|
return plist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* NB: does chdir internally */
|
||||||
static pid_list *scan_proc_pids(inode_list *ilist)
|
static pid_list *scan_proc_pids(inode_list *ilist)
|
||||||
{
|
{
|
||||||
DIR *d;
|
DIR *d;
|
||||||
@ -215,7 +216,7 @@ static pid_list *scan_proc_pids(inode_list *ilist)
|
|||||||
pid_t pid;
|
pid_t pid;
|
||||||
pid_list *plist;
|
pid_list *plist;
|
||||||
|
|
||||||
d = opendir(".");
|
d = opendir("/proc");
|
||||||
if (!d)
|
if (!d)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -329,7 +330,7 @@ Find processes which use FILEs or PORTs
|
|||||||
pp++;
|
pp++;
|
||||||
}
|
}
|
||||||
|
|
||||||
plist = scan_proc_pids(ilist);
|
plist = scan_proc_pids(ilist); /* changes dir to "/proc" */
|
||||||
|
|
||||||
if (!plist)
|
if (!plist)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user