summaryrefslogtreecommitdiff
path: root/perlio.c
diff options
context:
space:
mode:
authorAndy Dougherty <doughera@lafayette.edu>2015-12-29 22:47:42 -0500
committerAndy Dougherty <doughera@lafayette.edu>2016-01-04 11:10:33 -0500
commit36b1c8929241ab83b3003de806e94e66990e4c6d (patch)
tree21477cf4ddc6359dff519780359aa823bc362a3b /perlio.c
parentdf3d7b3a89fec1d036a500ba1f62f1c3d061ed99 (diff)
downloadperl-36b1c8929241ab83b3003de806e94e66990e4c6d.tar.gz
PATCH: Re: [perl #126847] fdclose(3) patch
This patch uses the fdclose() function from FreeBSD if it is available. It is based on the original patch supplied by Mariusz Zaborski <oshogbo@FreeBSD.org> in the RT ticket. The next patch will add Configure support for HAS_FDCLOSE.
Diffstat (limited to 'perlio.c')
-rw-r--r--perlio.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/perlio.c b/perlio.c
index 343c62e953..69f37551f3 100644
--- a/perlio.c
+++ b/perlio.c
@@ -3126,7 +3126,9 @@ PerlIOStdio_invalidate_fileno(pTHX_ FILE *f)
/* XXX this could use PerlIO_canset_fileno() and
* PerlIO_set_fileno() support from Configure
*/
-# if defined(__UCLIBC__)
+# if defined(HAS_FDCLOSE)
+ return fdclose(f, NULL) == 0 ? 1 : 0;
+# elif defined(__UCLIBC__)
/* uClibc must come before glibc because it defines __GLIBC__ as well. */
f->__filedes = -1;
return 1;