Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
U
unix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Rinat Striungis
unix
Commits
d73ba584
Commit
d73ba584
authored
8 years ago
by
Erik de Castro Lopo
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #72 from erikd/topic/readdir-deprecated
Don't use readdir_r if deprecated
parents
cd6eae1d
2951cd01
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cbits/HsUnix.c
+18
-1
18 additions, 1 deletion
cbits/HsUnix.c
changelog.md
+4
-0
4 additions, 0 deletions
changelog.md
with
22 additions
and
1 deletion
cbits/HsUnix.c
+
18
−
1
View file @
d73ba584
...
@@ -36,13 +36,30 @@ int __hsunix_push_module(int fd, const char *module)
...
@@ -36,13 +36,30 @@ int __hsunix_push_module(int fd, const char *module)
#endif
#endif
}
}
/*
* GNU glibc 2.23 and later deprecate `readdir_r` in favour of plain old
* `readdir` which in some upcoming POSIX standard is going to required to be
* re-entrant.
* Eventually we want to drop `readder_r` all together, but want to be
* compatible with older unixen which may not have a re-entrant `readdir`.
* Solution is to make systems with *known* re-entrant `readir` use that and use
* `readdir_r` whereever we have it and don't *know* that `readdir` is
* re-entrant.
*/
#if defined (__GLIBC__) && (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 23)
#define USE_READDIR_R 0
#else
#define USE_READDIR_R 1
#endif
/*
/*
* read an entry from the directory stream; opt for the
* read an entry from the directory stream; opt for the
* re-entrant friendly way of doing this, if available.
* re-entrant friendly way of doing this, if available.
*/
*/
int
__hscore_readdir
(
DIR
*
dirPtr
,
struct
dirent
**
pDirEnt
)
int
__hscore_readdir
(
DIR
*
dirPtr
,
struct
dirent
**
pDirEnt
)
{
{
#if HAVE_READDIR_R
#if HAVE_READDIR_R
&& USE_READDIR_R
struct
dirent
*
p
;
struct
dirent
*
p
;
int
res
;
int
res
;
static
unsigned
int
nm_max
=
(
unsigned
int
)
-
1
;
static
unsigned
int
nm_max
=
(
unsigned
int
)
-
1
;
...
...
This diff is collapsed.
Click to expand it.
changelog.md
+
4
−
0
View file @
d73ba584
# Changelog for [`unix` package](http://hackage.haskell.org/package/unix)
# Changelog for [`unix` package](http://hackage.haskell.org/package/unix)
## 2.7.2.1 *Sep 2016*
*
Don't use
`readdir_r`
if its deprecated.
## 2.7.2.0 *Apr 2016*
## 2.7.2.0 *Apr 2016*
*
Bundled with GHC 8.0.1
*
Bundled with GHC 8.0.1
...
...
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