summaryrefslogtreecommitdiffstats
path: root/src/util/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/util.c')
-rw-r--r--src/util/util.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/util/util.c b/src/util/util.c
index 8e20ab714..3a6c5d270 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -639,7 +639,8 @@ ssize_t sss_atomic_io(int fd, void *buf, size_t n, bool do_read)
}
return -1;
case 0:
- errno = EPIPE;
+ /* read returns 0 on end-of-file */
+ errno = do_read ? 0 : EPIPE;
return pos;
default:
pos += (size_t) res;