summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorSteve Peters <steve@fisharerojo.org>2007-05-01 15:32:15 +0000
committerSteve Peters <steve@fisharerojo.org>2007-05-01 15:32:15 +0000
commit3497a01ff49c0a24f2db9e69c6bb89e36e940ed4 (patch)
treec6028e5ca43baa2875933c4e28fbb762cbf121c0 /util.c
parent56d400ed3af68f3e129d79065e75af152cabbe59 (diff)
downloadperl-3497a01ff49c0a24f2db9e69c6bb89e36e940ed4.tar.gz
Add Perl_my_dirfd() to util.c
p4raw-id: //depot/perl@31112
Diffstat (limited to 'util.c')
-rw-r--r--util.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/util.c b/util.c
index 6396ed29a6..2ec39407ca 100644
--- a/util.c
+++ b/util.c
@@ -5807,6 +5807,23 @@ Perl_get_db_sub(pTHX_ SV **svp, CV *cv)
}
}
+int
+Perl_my_dirfd(DIR * dir) {
+
+ /* Most dirfd implementations have problems when passed NULL. */
+ if(!dir)
+ return -1;
+#ifdef HAS_DIRFD
+ return dirfd(dir);
+#elif defined(HAS_DIR_DD_FD)
+ return dir->dd_fd;
+#else
+ Perl_die(aTHX_ PL_no_func, "dirfd");
+ /* NOT REACHED */
+ return 0;
+#endif
+}
+
/*
* Local variables:
* c-indentation-style: bsd