Close FD. Return 0 if successful, -1 (setting errno) otherwise. If close fails with errno == EINTR, POSIX says the file descriptor is in an unspecified state, so keep trying to close FD but do not consider EBADF to be an error. Do not process signals. This all differs somewhat from functions like ifdatasync and ifsync. */
| 907 | consider EBADF to be an error. Do not process signals. This all |
| 908 | differs somewhat from functions like ifdatasync and ifsync. */ |
| 909 | static int |
| 910 | iclose (int fd) |
| 911 | { |
| 912 | if (close (fd) != 0) |
| 913 | do |
| 914 | if (errno != EINTR) |
| 915 | return -1; |
| 916 | while (close (fd) != 0 && errno != EBADF); |
| 917 | |
| 918 | return 0; |
| 919 | } |
| 920 | |
| 921 | static int synchronize_output (void); |
| 922 |