diff options
author | Daniel Mack <github@zonque.org> | 2015-09-09 09:57:29 +0200 |
---|---|---|
committer | Daniel Mack <github@zonque.org> | 2015-09-09 09:57:29 +0200 |
commit | 0fa7d1f5be847d4804eb3bf6a4c10333ea14e0bc (patch) | |
tree | 6afb70cc560bd94219f81495ff699c83b404e18c /src/shared | |
parent | bed2c013b6570908a114a337632000cf9c9de838 (diff) | |
parent | ece174c5439021e32ebcc858842de9586072c006 (diff) |
Merge pull request #1207 from poettering/coccinelle-fixes
Coccinelle fixes
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/ask-password-api.c | 19 | ||||
-rw-r--r-- | src/shared/bus-util.c | 7 | ||||
-rw-r--r-- | src/shared/conf-parser.c | 3 | ||||
-rw-r--r-- | src/shared/logs-show.c | 3 | ||||
-rw-r--r-- | src/shared/pager.c | 3 |
5 files changed, 12 insertions, 23 deletions
diff --git a/src/shared/ask-password-api.c b/src/shared/ask-password-api.c index ca4c24ebde..f5cff6fc56 100644 --- a/src/shared/ask-password-api.c +++ b/src/shared/ask-password-api.c @@ -331,8 +331,8 @@ int ask_password_agent( fd = mkostemp_safe(temp, O_WRONLY|O_CLOEXEC); if (fd < 0) { - log_error_errno(errno, "Failed to create password file: %m"); - r = -errno; + r = log_error_errno(errno, + "Failed to create password file: %m"); goto finish; } @@ -340,8 +340,7 @@ int ask_password_agent( f = fdopen(fd, "w"); if (!f) { - log_error_errno(errno, "Failed to allocate FILE: %m"); - r = -errno; + r = log_error_errno(errno, "Failed to allocate FILE: %m"); goto finish; } @@ -349,8 +348,7 @@ int ask_password_agent( signal_fd = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); if (signal_fd < 0) { - log_error_errno(errno, "signalfd(): %m"); - r = -errno; + r = log_error_errno(errno, "signalfd(): %m"); goto finish; } @@ -395,8 +393,7 @@ int ask_password_agent( final[sizeof(final)-9] = 'k'; if (rename(temp, final) < 0) { - log_error_errno(errno, "Failed to rename query file: %m"); - r = -errno; + r = log_error_errno(errno, "Failed to rename query file: %m"); goto finish; } @@ -432,8 +429,7 @@ int ask_password_agent( if (errno == EINTR) continue; - log_error_errno(errno, "poll() failed: %m"); - r = -errno; + r = log_error_errno(errno, "poll() failed: %m"); goto finish; } @@ -471,8 +467,7 @@ int ask_password_agent( errno == EINTR) continue; - log_error_errno(errno, "recvmsg() failed: %m"); - r = -errno; + r = log_error_errno(errno, "recvmsg() failed: %m"); goto finish; } diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c index d9cc19700e..36c44227c5 100644 --- a/src/shared/bus-util.c +++ b/src/shared/bus-util.c @@ -1884,11 +1884,8 @@ int bus_wait_for_jobs(BusWaitForJobs *d, bool quiet) { log_debug_errno(q, "Got result %s/%m for job %s", strna(d->result), strna(d->name)); } - free(d->name); - d->name = NULL; - - free(d->result); - d->result = NULL; + d->name = mfree(d->name); + d->result = mfree(d->result); } return r; diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c index 36150d8744..23512f0d35 100644 --- a/src/shared/conf-parser.c +++ b/src/shared/conf-parser.c @@ -232,8 +232,7 @@ static int parse_line(const char* unit, "Unknown section '%s'. Ignoring.", n); free(n); - free(*section); - *section = NULL; + *section = mfree(*section); *section_line = 0; *section_ignored = true; } else { diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c index 9a5ffb7a6c..7790c1a3c8 100644 --- a/src/shared/logs-show.c +++ b/src/shared/logs-show.c @@ -334,10 +334,9 @@ static int output_short( break; case OUTPUT_SHORT_PRECISE: r = strftime(buf, sizeof(buf), "%b %d %H:%M:%S", gettime_r(&t, &tm)); - if (r > 0) { + if (r > 0) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ".%06llu", (unsigned long long) (x % USEC_PER_SEC)); - } break; default: r = strftime(buf, sizeof(buf), "%b %d %H:%M:%S", gettime_r(&t, &tm)); diff --git a/src/shared/pager.c b/src/shared/pager.c index 3992f9c837..55fd5cb79e 100644 --- a/src/shared/pager.c +++ b/src/shared/pager.c @@ -74,8 +74,7 @@ int pager_open(bool jump_to_end) { pager_pid = fork(); if (pager_pid < 0) { - r = -errno; - log_error_errno(errno, "Failed to fork pager: %m"); + r = log_error_errno(errno, "Failed to fork pager: %m"); safe_close_pair(fd); return r; } |