summaryrefslogtreecommitdiff
path: root/src/libstddjb/fd_close.c
blob: cb52d4fe058b72447180f5b9ddb98a392eb6b5e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* ISC license. */

#include <unistd.h>
#include <errno.h>
#include <skalibs/djbunix.h>

int fd_close (int fd)
{
  for (;;)
  {
    if (!close(fd) || errno == EINPROGRESS) break ;
    if (errno != EINTR) return -1 ;
  }
  return 0 ;
}