Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
f131a71f
Commit
f131a71f
authored
28 years ago
by
Fredrik Hübinette (Hubbe)
Browse files
Options
Downloads
Patches
Plain Diff
readdir_r fixed?
Rev: src/modules/files/efuns.c:1.14
parent
93673591
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/modules/files/efuns.c
+9
-1
9 additions, 1 deletion
src/modules/files/efuns.c
with
9 additions
and
1 deletion
src/modules/files/efuns.c
+
9
−
1
View file @
f131a71f
...
@@ -162,6 +162,12 @@ void f_mkdir(INT32 args)
...
@@ -162,6 +162,12 @@ void f_mkdir(INT32 args)
push_int
(
i
);
push_int
(
i
);
}
}
#undef HAVE_REDDIR_R
#if defined(HAVE_SOLARIS_READDIR_R) || defined(HAVE_SOLARIS_HPUX_R) || \
defined(HAVE_POSIX_R)
#define HAVE_READDIR_R
#endif
void
f_get_dir
(
INT32
args
)
void
f_get_dir
(
INT32
args
)
{
{
struct
svalue
*
save_sp
=
sp
;
struct
svalue
*
save_sp
=
sp
;
...
@@ -172,7 +178,7 @@ void f_get_dir(INT32 args)
...
@@ -172,7 +178,7 @@ void f_get_dir(INT32 args)
get_all_args
(
"get_dir"
,
args
,
"%s"
,
&
path
);
get_all_args
(
"get_dir"
,
args
,
"%s"
,
&
path
);
#if defined(_REENTRANT) &&
(
defined(HAVE_
SOLARIS_
READDIR_R)
|| defined(HAVE_HPUX_READDIR_R) || defined(HAVE_POSIX_READDIR_R))
#if defined(_REENTRANT) && defined(HAVE_READDIR_R)
THREADS_ALLOW
();
THREADS_ALLOW
();
dir
=
opendir
(
path
);
dir
=
opendir
(
path
);
THREADS_DISALLOW
();
THREADS_DISALLOW
();
...
@@ -205,6 +211,7 @@ void f_get_dir(INT32 args)
...
@@ -205,6 +211,7 @@ void f_get_dir(INT32 args)
/* Solaris readdir_r returns the second arg on success,
/* Solaris readdir_r returns the second arg on success,
* and returns NULL on error or at end of dir.
* and returns NULL on error or at end of dir.
*/
*/
errno
=
0
;
do
{
do
{
d
=
readdir_r
(
dir
,
tmp
);
d
=
readdir_r
(
dir
,
tmp
);
}
while
((
!
d
)
&&
((
errno
==
EAGAIN
)
||
(
errno
==
EINTR
)));
}
while
((
!
d
)
&&
((
errno
==
EAGAIN
)
||
(
errno
==
EINTR
)));
...
@@ -220,6 +227,7 @@ void f_get_dir(INT32 args)
...
@@ -220,6 +227,7 @@ void f_get_dir(INT32 args)
* 0 - Successfull operation.
* 0 - Successfull operation.
* -1 - End of directory or encountered an error (sets errno).
* -1 - End of directory or encountered an error (sets errno).
*/
*/
errno
=
0
;
if
(
readdir_r
(
dir
,
tmp
))
{
if
(
readdir_r
(
dir
,
tmp
))
{
d
=
NULL
;
d
=
NULL
;
err
=
errno
;
err
=
errno
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment