summaryrefslogtreecommitdiffstats
path: root/src/monitor
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2010-04-22 11:44:46 +0200
committerStephen Gallagher <sgallagh@redhat.com>2010-04-26 09:54:59 -0400
commitc7fc1078dad4b237256bfedca5121a6a55ac625d (patch)
tree970ec7722ebd7e23f8570ffdbbc90e3b4730cb90 /src/monitor
parent5a5eb2619fed6b37178d3b2c58970788c55cb529 (diff)
downloadsssd-c7fc1078dad4b237256bfedca5121a6a55ac625d.tar.gz
sssd-c7fc1078dad4b237256bfedca5121a6a55ac625d.tar.xz
sssd-c7fc1078dad4b237256bfedca5121a6a55ac625d.zip
Fix a potential memory violation
If read() returns with errno set to EINTR -1 is added to total_len.
Diffstat (limited to 'src/monitor')
-rw-r--r--src/monitor/monitor.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index 0a98d09c2..c7997e42e 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -1371,7 +1371,8 @@ static void process_config_file(struct tevent_context *ev,
while (total_len < event_size) {
len = read(file_ctx->mt_ctx->inotify_fd, buf+total_len,
event_size-total_len);
- if (len == -1 && errno != EINTR) {
+ if (len == -1) {
+ if (errno == EINTR) continue;
DEBUG(0, ("Critical error reading inotify file descriptor.\n"));
goto done;
}
@@ -1391,7 +1392,8 @@ static void process_config_file(struct tevent_context *ev,
total_len = 0;
while (total_len < in_event->len) {
len = read(file_ctx->mt_ctx->inotify_fd, &name, in_event->len);
- if (len == -1 && errno != EINTR) {
+ if (len == -1) {
+ if (errno == EINTR) continue;
DEBUG(0, ("Critical error reading inotify file descriptor.\n"));
goto done;
}