From: Christian Grothoff Date: Wed, 25 Jul 2012 08:40:33 +0000 (+0000) Subject: -preserve errno X-Git-Tag: initial-import-from-subversion-38251~12350 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=130185df47d89b3df36c8371fe18eccd76fca7fc;p=oweals%2Fgnunet.git -preserve errno --- diff --git a/src/util/disk.c b/src/util/disk.c index 24a33d497..b4674c99b 100644 --- a/src/util/disk.c +++ b/src/util/disk.c @@ -843,7 +843,8 @@ GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle * h, void *result, */ ssize_t GNUNET_DISK_file_read_non_blocking (const struct GNUNET_DISK_FileHandle * h, - void *result, size_t len) + void *result, + size_t len) { if (h == NULL) { @@ -891,10 +892,14 @@ GNUNET_DISK_file_read_non_blocking (const struct GNUNET_DISK_FileHandle * h, /* set to non-blocking, read, then set back */ flags = fcntl (h->fd, F_GETFL); if (0 == (flags & O_NONBLOCK)) - fcntl (h->fd, F_SETFL, flags | O_NONBLOCK); + (void) fcntl (h->fd, F_SETFL, flags | O_NONBLOCK); ret = read (h->fd, result, len); if (0 == (flags & O_NONBLOCK)) - fcntl (h->fd, F_SETFL, flags); + { + int eno = errno; + (void) fcntl (h->fd, F_SETFL, flags); + errno = eno; + } return ret; #endif }