mirror of
https://github.com/tmux/tmux.git
synced 2025-01-06 07:48:48 +00:00
Still need to globfree on failure.
This commit is contained in:
parent
e19df0e869
commit
6ce8fe0537
@ -30,19 +30,12 @@ getdtablecount(void)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
glob_t g;
|
||||
int n;
|
||||
int n = 0;
|
||||
|
||||
if (snprintf(path, sizeof path, "/proc/%ld/fd/*", (long)getpid()) < 0)
|
||||
fatal("snprintf overflow");
|
||||
switch (glob(path, 0, NULL, &g)) {
|
||||
case GLOB_NOMATCH:
|
||||
return (0);
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
fatal("glob(\"%s\") failed", path);
|
||||
}
|
||||
n = g.gl_pathc;
|
||||
if (glob(path, 0, NULL, &g) == 0)
|
||||
n = g.gl_pathc;
|
||||
globfree(&g);
|
||||
return (n);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user