diff options
author | Michal Zidek <mzidek@redhat.com> | 2013-09-20 11:49:32 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-11-15 20:50:35 +0100 |
commit | 4364c85b3fbe817067149a76ff7016f795a7d3b9 (patch) | |
tree | 5fcf0f518df5b0dab51779059c94c875c94cefb9 /src/monitor | |
parent | 84fbb0cad534308254a8a8ad837d1924496cfe71 (diff) | |
download | sssd-4364c85b3fbe817067149a76ff7016f795a7d3b9.tar.gz sssd-4364c85b3fbe817067149a76ff7016f795a7d3b9.tar.xz sssd-4364c85b3fbe817067149a76ff7016f795a7d3b9.zip |
monitor: Stop using unnecessary helper pointer.
We allocate memory using helper pointer 'buf' only to assign
the address to another pointer. We should use the second pointer
only.
resolves:
https://fedorahosted.org/sssd/ticket/1359
Diffstat (limited to 'src/monitor')
-rw-r--r-- | src/monitor/monitor.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c index d0a3fcb26..f8a02b8b8 100644 --- a/src/monitor/monitor.c +++ b/src/monitor/monitor.c @@ -1692,16 +1692,13 @@ static void process_config_file(struct tevent_context *ev, { TALLOC_CTX *tmp_ctx; struct inotify_event *in_event; - char *buf; char *name; ssize_t len; - ssize_t event_size; struct config_file_ctx *file_ctx; struct config_file_callback *cb; struct rewatch_ctx *rw_ctx; errno_t ret; - event_size = sizeof(struct inotify_event); file_ctx = talloc_get_type(ptr, struct config_file_ctx); DEBUG(1, ("Processing config file changes\n")); @@ -1709,13 +1706,14 @@ static void process_config_file(struct tevent_context *ev, tmp_ctx = talloc_new(NULL); if (!tmp_ctx) return; - buf = talloc_size(tmp_ctx, event_size); - if (!buf) { + in_event = talloc(tmp_ctx, struct inotify_event); + if (!in_event) { goto done; } errno = 0; - len = sss_atomic_read_s(file_ctx->mt_ctx->inotify_fd, buf, event_size); + len = sss_atomic_read_s(file_ctx->mt_ctx->inotify_fd, in_event, + sizeof(struct inotify_event)); if (len == -1) { ret = errno; DEBUG(SSSDBG_CRIT_FAILURE, @@ -1724,8 +1722,6 @@ static void process_config_file(struct tevent_context *ev, goto done; } - in_event = (struct inotify_event *)buf; - if (in_event->len > 0) { /* Read in the name, even though we don't use it, * so that read ptr is in the right place |