mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-03 10:21:46 +02:00
12568: check sysconf(_SC_OPEN_MAX) if available instead of OPEN_MAX/NOFILES.
This commit is contained in:
parent
3bca186819
commit
cb89544d32
6 changed files with 36 additions and 3 deletions
|
@ -1,3 +1,9 @@
|
|||
2000-08-08 Clint Adams <schizo@debian.org>
|
||||
|
||||
* 12568: configure.in, Src/compat.c, Src/exec.c, Src/init.c,
|
||||
Src/system.h: check sysconf(_SC_OPEN_MAX) if available instead
|
||||
of OPEN_MAX/NOFILES.
|
||||
|
||||
2000-08-08 Sven Wischnowsky <wischnow@zsh.org>
|
||||
|
||||
* 12567: Completion/Linux/_rpm, Src/Zle/computil.c: handle the
|
||||
|
|
21
Src/compat.c
21
Src/compat.c
|
@ -171,6 +171,27 @@ zpathmax(char *dir)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYSCONF
|
||||
/* This is replaced by a macro from system.h if not HAVE_PATHCONF. *
|
||||
* 0 is returned if _SC_OPEN_MAX is unavailable *
|
||||
* -1 is returned on error *
|
||||
* *
|
||||
* Neither of these should happen, but resort to OPEN_MAX rather *
|
||||
* than return 0 or -1 just in case. */
|
||||
|
||||
/**/
|
||||
mod_export long
|
||||
zopenmax(void)
|
||||
{
|
||||
long openmax;
|
||||
|
||||
openmax = sysconf(_SC_OPEN_MAX);
|
||||
if(openmax < 1)
|
||||
return OPEN_MAX;
|
||||
else
|
||||
return openmax;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**/
|
||||
mod_export char *
|
||||
|
|
|
@ -1404,8 +1404,11 @@ static void
|
|||
closeallelse(struct multio *mn)
|
||||
{
|
||||
int i, j;
|
||||
long openmax;
|
||||
|
||||
for (i = 0; i < OPEN_MAX; i++)
|
||||
openmax = zopenmax();
|
||||
|
||||
for (i = 0; i < openmax; i++)
|
||||
if (mn->pipe != i) {
|
||||
for (j = 0; j < mn->ct; j++)
|
||||
if (mn->fds[j] == i)
|
||||
|
|
|
@ -1173,7 +1173,7 @@ zsh_main(int argc, char **argv)
|
|||
break;
|
||||
} while (zsh_name);
|
||||
|
||||
fdtable_size = OPEN_MAX;
|
||||
fdtable_size = zopenmax();
|
||||
fdtable = zcalloc(fdtable_size);
|
||||
|
||||
createoptiontable();
|
||||
|
|
|
@ -220,6 +220,9 @@ struct timezone {
|
|||
# define OPEN_MAX 64
|
||||
# endif
|
||||
#endif
|
||||
#ifndef HAVE_SYSCONF
|
||||
# define zopenmax() (long) OPEN_MAX
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
# include <fcntl.h>
|
||||
|
|
|
@ -864,7 +864,7 @@ AC_CHECK_FUNCS(strftime difftime gettimeofday \
|
|||
signgam \
|
||||
putenv getenv \
|
||||
brk sbrk \
|
||||
pathconf)
|
||||
pathconf sysconf)
|
||||
AC_FUNC_STRCOLL
|
||||
|
||||
if test $ac_cv_func_setpgrp = yes; then
|
||||
|
|
Loading…
Reference in a new issue