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