Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zsh
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
Debian
zsh
Commits
c43a6be9
Commit
c43a6be9
authored
Nov 03, 2001
by
Bart Schaefer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
16094: zopenmax() need only return the highest-numbered open descriptor
parent
d98a67c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
5 deletions
+25
-5
Src/compat.c
Src/compat.c
+25
-5
No files found.
Src/compat.c
View file @
c43a6be9
...
...
@@ -198,12 +198,32 @@ zpathmax(char *dir)
mod_export
long
zopenmax
(
void
)
{
long
openmax
=
sysconf
(
_SC_OPEN_MAX
);
static
long
openmax
=
0
;
if
(
openmax
<
1
)
{
if
((
openmax
=
sysconf
(
_SC_OPEN_MAX
))
<
1
)
{
openmax
=
OPEN_MAX
;
}
else
if
(
openmax
>
OPEN_MAX
)
{
/* On some systems, "limit descriptors unlimited" or the *
* equivalent will set openmax to a huge number. Unless *
* there actually is a file descriptor > OPEN_MAX already *
* open, nothing in zsh requires the true maximum, and in *
* fact it causes inefficiency elsewhere if we report it. *
* So, report the maximum of OPEN_MAX or the largest open *
* descriptor (is there a better way to find that?). */
long
i
,
j
=
OPEN_MAX
;
for
(
i
=
j
;
i
<
openmax
;
i
+=
(
errno
!=
EINTR
))
{
errno
=
0
;
if
(
fcntl
(
i
,
F_GETFL
,
0
)
<
0
&&
(
errno
==
EBADF
||
errno
==
EINTR
))
continue
;
j
=
i
;
}
openmax
=
j
;
}
}
if
(
openmax
<
1
)
return
OPEN_MAX
;
else
return
openmax
;
return
(
max_zsh_fd
>
openmax
)
?
max_zsh_fd
:
openmax
;
}
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment