summaryrefslogtreecommitdiff
path: root/src/libstddjb/fd_chmod.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstddjb/fd_chmod.c')
-rw-r--r--src/libstddjb/fd_chmod.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libstddjb/fd_chmod.c b/src/libstddjb/fd_chmod.c
new file mode 100644
index 0000000..a70c537
--- /dev/null
+++ b/src/libstddjb/fd_chmod.c
@@ -0,0 +1,17 @@
+/* ISC license. */
+
+ /* OpenBSD manages to bork the fchmod declaration */
+#include <skalibs/nonposix.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <skalibs/djbunix.h>
+
+int fd_chmod (int fd, unsigned int mode)
+{
+ register int r ;
+ do
+ r = fchmod(fd, (mode_t)mode) ;
+ while ((r == -1) && (errno == EINTR)) ;
+ return r ;
+}