mirror of
https://github.com/systemd/systemd.git
synced 2024-11-27 20:23:36 +08:00
Merge pull request #13239 from poettering/coverity-fixes
four coverity fixes
This commit is contained in:
commit
1be8044b5b
@ -1153,8 +1153,11 @@ void job_add_to_run_queue(Job *j) {
|
||||
log_warning_errno(r, "Failed to enable job run queue event source, ignoring: %m");
|
||||
}
|
||||
|
||||
prioq_put(j->manager->run_queue, j, &j->run_queue_idx);
|
||||
j->in_run_queue = true;
|
||||
r = prioq_put(j->manager->run_queue, j, &j->run_queue_idx);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed put job in run queue, ignoring: %m");
|
||||
else
|
||||
j->in_run_queue = true;
|
||||
}
|
||||
|
||||
void job_add_to_dbus_queue(Job *j) {
|
||||
|
@ -46,30 +46,30 @@ STATIC_DESTRUCTOR_REGISTER(arg_disks, hashmap_freep);
|
||||
STATIC_DESTRUCTOR_REGISTER(arg_default_options, freep);
|
||||
STATIC_DESTRUCTOR_REGISTER(arg_default_keyfile, freep);
|
||||
|
||||
static int split_keyspec(const char *keyspec, char **keyfile, char **keydev) {
|
||||
static int split_keyspec(const char *keyspec, char **ret_keyfile, char **ret_keydev) {
|
||||
_cleanup_free_ char *kfile = NULL, *kdev = NULL;
|
||||
char *c;
|
||||
const char *c;
|
||||
|
||||
assert(keyspec);
|
||||
assert(keyfile);
|
||||
assert(keydev);
|
||||
assert(ret_keyfile);
|
||||
assert(ret_keydev);
|
||||
|
||||
c = strrchr(keyspec, ':');
|
||||
if (c) {
|
||||
kfile = strndup(keyspec, c-keyspec);
|
||||
kdev = strdup(c + 1);
|
||||
if (!*kfile || !*kdev)
|
||||
if (!kfile || !kdev)
|
||||
return log_oom();
|
||||
} else {
|
||||
/* No keydev specified */
|
||||
kfile = strdup(keyspec);
|
||||
kdev = NULL;
|
||||
if (!*kfile)
|
||||
if (!kfile)
|
||||
return log_oom();
|
||||
}
|
||||
|
||||
*keyfile = TAKE_PTR(kfile);
|
||||
*keydev = TAKE_PTR(kdev);
|
||||
*ret_keyfile = TAKE_PTR(kfile);
|
||||
*ret_keydev = TAKE_PTR(kdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -462,7 +462,7 @@ int unit_file_find_fragment(
|
||||
|
||||
r = unit_ids_map_get(unit_ids_map, template, &fragment);
|
||||
if (r < 0 && !IN_SET(r, -ENOENT, -ENXIO))
|
||||
return log_debug_errno(r, "Cannot load template %s: %m", *t);
|
||||
return log_debug_errno(r, "Cannot load template %s: %m", template);
|
||||
|
||||
if (fragment) {
|
||||
/* Add any aliases of the original name to the set of names */
|
||||
|
@ -1,8 +1,9 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||
#include <getopt.h>
|
||||
|
||||
#include "log.h"
|
||||
#include "fd-util.h"
|
||||
#include "fs-util.h"
|
||||
#include "log.h"
|
||||
#include "main-func.h"
|
||||
|
||||
static char *arg_root = NULL;
|
||||
@ -97,6 +98,9 @@ static int run(int argc, char **argv) {
|
||||
log_error_errno(r, "failed: %m");
|
||||
else
|
||||
log_info("→ %s", p);
|
||||
|
||||
if (FLAGS_SET(arg_flags, CHASE_OPEN))
|
||||
safe_close(r);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user