aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstddjb/fd_chmod.c
blob: e88271104edfa8bb44be189a2b8e7da16ad9ac69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* ISC license. */

 /* OpenBSD manages to bork the fchmod declaration */

#include <skalibs/nonposix.h>

#include <sys/stat.h>
#include <errno.h>

#include <skalibs/djbunix.h>

int fd_chmod (int fd, unsigned int mode)
{
  int e = errno ;
  int r ;
  do r = fchmod(fd, (mode_t)mode) ;
  while (r == -1 && errno == EINTR) ;
  if (r >= 0) errno = e ;
  return r ;
}