summaryrefslogtreecommitdiffstats
path: root/src/monitor
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2010-06-08 15:47:34 -0400
committerStephen Gallagher <sgallagh@redhat.com>2010-06-10 10:17:21 -0400
commitcedc75748b155f7c1287de8796409dd79ef7aecd (patch)
tree68eab2b23f83565f0e293066c30aa339990d6c6a /src/monitor
parentca95af6e15ddc8928684327ff05353b1e3a17acd (diff)
downloadsssd-cedc75748b155f7c1287de8796409dd79ef7aecd.tar.gz
sssd-cedc75748b155f7c1287de8796409dd79ef7aecd.tar.xz
sssd-cedc75748b155f7c1287de8796409dd79ef7aecd.zip
Properly handle read() and write() throughout the SSSD
We need to guarantee at all times that reads and writes complete successfully. This means that they must be checked for returning EINTR and EAGAIN, and all writes must be wrapped in a loop to ensure that they do not truncate their output.
Diffstat (limited to 'src/monitor')
-rw-r--r--src/monitor/monitor.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index 75d893ebf..acac12dba 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -1372,7 +1372,7 @@ static void process_config_file(struct tevent_context *ev,
len = read(file_ctx->mt_ctx->inotify_fd, buf+total_len,
event_size-total_len);
if (len == -1) {
- if (errno == EINTR) continue;
+ if (errno == EINTR || errno == EAGAIN) continue;
DEBUG(0, ("Critical error reading inotify file descriptor.\n"));
goto done;
}
@@ -1393,7 +1393,7 @@ static void process_config_file(struct tevent_context *ev,
while (total_len < in_event->len) {
len = read(file_ctx->mt_ctx->inotify_fd, &name, in_event->len);
if (len == -1) {
- if (errno == EINTR) continue;
+ if (errno == EINTR || errno == EAGAIN) continue;
DEBUG(0, ("Critical error reading inotify file descriptor.\n"));
goto done;
}