[systemd-commits] 5 commits - src/core src/journal src/libsystemd-bus src/shared src/sysctl
Zbigniew JÄdrzejewski-Szmek
zbyszek at kemper.freedesktop.org
Wed Mar 27 09:03:30 PDT 2013
src/core/execute.c | 13 +++++++++++--
src/journal/catalog.c | 4 ++--
src/libsystemd-bus/sd-bus.c | 2 +-
src/shared/util.c | 6 ++++--
src/sysctl/sysctl.c | 2 +-
5 files changed, 19 insertions(+), 8 deletions(-)
New commits:
commit 2e8fb7026d3c560194cfe9f83935ce0b16263da0
Author: Lukas Nykryn <lnykryn at redhat.com>
Date: Wed Mar 27 10:44:21 2013 +0100
log: fix error codes handling in catalog_list_items
It does not make sense to print error code from previous loop.
diff --git a/src/journal/catalog.c b/src/journal/catalog.c
index dacf5c5..6b195f6 100644
--- a/src/journal/catalog.c
+++ b/src/journal/catalog.c
@@ -616,7 +616,7 @@ int catalog_list_items(FILE *f, bool oneline, char **items) {
k = sd_id128_from_string(*item, &id);
if (k < 0) {
log_error("Failed to parse id128 '%s': %s",
- *item, strerror(-r));
+ *item, strerror(-k));
if (r < 0)
r = k;
continue;
@@ -626,7 +626,7 @@ int catalog_list_items(FILE *f, bool oneline, char **items) {
if (k < 0) {
log_full(k == -ENOENT ? LOG_NOTICE : LOG_ERR,
"Failed to retrieve catalog entry for '%s': %s",
- *item, strerror(-r));
+ *item, strerror(-k));
if (r < 0)
r = k;
continue;
commit 531991b64d1fd28218c48bab364ef8c4e80354fa
Author: Lukas Nykryn <lnykryn at redhat.com>
Date: Wed Mar 27 10:44:20 2013 +0100
sd-bus: check c->path for null instead of path
diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c
index 5f2ede0..6acc59e 100644
--- a/src/libsystemd-bus/sd-bus.c
+++ b/src/libsystemd-bus/sd-bus.c
@@ -1944,7 +1944,7 @@ static int bus_add_object(
return -ENOMEM;
c->path = strdup(path);
- if (!path) {
+ if (!c->path) {
free(c);
return -ENOMEM;
}
commit 6f6fad96addf6b00b55c98cc0d0d8026b0c1e7ca
Author: Eelco Dolstra <eelco.dolstra at logicblox.com>
Date: Wed Mar 27 13:41:59 2013 +0100
systemd-sysctl: Handle missing /etc/sysctl.conf properly
Since fabe5c0e5fce730aa66e10a9c4f9fdd443d7aeda, systemd-sysctl returns
a non-zero exit code if /etc/sysctl.conf does not exist, due to a
broken ENOENT check.
diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c
index 2d43660..79f3f77 100644
--- a/src/sysctl/sysctl.c
+++ b/src/sysctl/sysctl.c
@@ -125,7 +125,7 @@ static int parse_file(Hashmap *sysctl_options, const char *path, bool ignore_eno
r = search_and_fopen_nulstr(path, "re", conf_file_dirs, &f);
if (r < 0) {
- if (ignore_enoent && errno == -ENOENT)
+ if (ignore_enoent && r == -ENOENT)
return 0;
log_error("Failed to open file '%s', ignoring: %s", path, strerror(-r));
commit f36a783ca7b8200d4e865a49342e44929c0f4c06
Author: Václav PavlÃn <vpavlin at redhat.com>
Date: Wed Mar 27 15:16:37 2013 +0100
shared: free dt (temporary dir name) on fail
[zj: modified to not to try to rmdir() dir we haven't created.]
diff --git a/src/shared/util.c b/src/shared/util.c
index 0444cf4..8fa01fa 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -5708,7 +5708,7 @@ int create_tmp_dir(char template[], char** dir_name) {
dt = strjoin(d, "/tmp", NULL);
if (!dt) {
r = log_oom();
- goto fail2;
+ goto fail3;
}
umask(0000);
@@ -5716,7 +5716,7 @@ int create_tmp_dir(char template[], char** dir_name) {
if (r) {
log_error("Can't create directory %s: %m", dt);
r = -errno;
- goto fail1;
+ goto fail2;
}
log_debug("Created temporary directory %s", dt);
@@ -5734,6 +5734,8 @@ int create_tmp_dir(char template[], char** dir_name) {
fail1:
rmdir(dt);
fail2:
+ free(dt);
+fail3:
rmdir(template);
return r;
}
commit ebf4fb3d368732d9f41cb40e3084182c04e731b2
Author: Václav PavlÃn <vpavlin at redhat.com>
Date: Wed Mar 27 15:16:35 2013 +0100
core: check return value of rm_rf_dangerous and warn if it fails
diff --git a/src/core/execute.c b/src/core/execute.c
index bc876a3..6aa0083 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -1559,10 +1559,19 @@ void exec_context_tmp_dirs_done(ExecContext *c) {
for(dirp = dirs; *dirp; dirp++) {
char *dir;
- rm_rf_dangerous(*dirp, false, true, false);
+ int r;
+ r = rm_rf_dangerous(*dirp, false, true, false);
dir = dirname(*dirp);
- rmdir(dir);
+ if (r < 0)
+ log_warning("Failed to remove content of temporary directory %s: %s",
+ dir, strerror(-r));
+ else {
+ r = rmdir(dir);
+ if (r < 0)
+ log_warning("Failed to remove temporary directory %s: %s",
+ dir, strerror(-r));
+ }
free(*dirp);
}
More information about the systemd-commits
mailing list