[systemd-commits] 5 commits - src/activate src/core src/journal src/readahead src/shared src/tmpfiles TODO units/user
Zbigniew JÄdrzejewski-Szmek
zbyszek at kemper.freedesktop.org
Sun Mar 31 16:53:09 PDT 2013
TODO | 5 +++
src/activate/activate.c | 8 ++++-
src/core/main.c | 16 +++--------
src/core/manager.c | 3 --
src/journal/journalctl.c | 2 -
src/readahead/readahead-collect.c | 3 --
src/shared/ask-password-api.c | 3 --
src/tmpfiles/tmpfiles.c | 54 +++++++++++++-------------------------
units/user/default.target | 1
9 files changed, 41 insertions(+), 54 deletions(-)
New commits:
commit 7989e1f2d79891ff73dea0ede1c98c47b62547db
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Sun Mar 31 19:50:30 2013 -0400
Partially revert e62d8c394474
The ~80 chars per line part wasn't well received.
diff --git a/src/core/main.c b/src/core/main.c
index bd7fc46..35cd772 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -118,8 +118,7 @@ _noreturn_ static void crash(int sig) {
pid = fork();
if (pid < 0)
- log_error("Caught <%s>, cannot fork for core dump: %s",
- signal_to_string(sig), strerror(errno));
+ log_error("Caught <%s>, cannot fork for core dump: %s", signal_to_string(sig), strerror(errno));
else if (pid == 0) {
struct rlimit rl;
@@ -151,15 +150,11 @@ _noreturn_ static void crash(int sig) {
/* Order things nicely. */
r = wait_for_terminate(pid, &status);
if (r < 0)
- log_error("Caught <%s>, waitpid() failed: %s",
- signal_to_string(sig), strerror(-r));
+ log_error("Caught <%s>, waitpid() failed: %s", signal_to_string(sig), strerror(-r));
else if (status.si_code != CLD_DUMPED)
- log_error("Caught <%s>, core dump failed.",
- signal_to_string(sig));
+ log_error("Caught <%s>, core dump failed.", signal_to_string(sig));
else
- log_error("Caught <%s>, dumped core as pid %lu.",
- signal_to_string(sig),
- (unsigned long) pid);
+ log_error("Caught <%s>, dumped core as pid %lu.", signal_to_string(sig), (unsigned long) pid);
}
}
@@ -190,8 +185,7 @@ _noreturn_ static void crash(int sig) {
_exit(1);
}
- log_info("Successfully spawned crash shell as pid %lu.",
- (unsigned long) pid);
+ log_info("Successfully spawned crash shell as pid %lu.", (unsigned long) pid);
}
log_info("Freezing execution.");
diff --git a/src/core/manager.c b/src/core/manager.c
index 8f4eb0b..2e89f19 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -1230,8 +1230,7 @@ static int manager_process_notify_fd(Manager *m) {
if (!u) {
u = cgroup_unit_by_pid(m, ucred->pid);
if (!u) {
- log_warning("Cannot find unit for notify message of PID %lu.",
- (unsigned long) ucred->pid);
+ log_warning("Cannot find unit for notify message of PID %lu.", (unsigned long) ucred->pid);
continue;
}
}
diff --git a/src/readahead/readahead-collect.c b/src/readahead/readahead-collect.c
index 643a5a8..b2d0f68 100644
--- a/src/readahead/readahead-collect.c
+++ b/src/readahead/readahead-collect.c
@@ -291,8 +291,7 @@ static int collect(const char *root) {
goto finish;
}
- fanotify_fd = fanotify_init(FAN_CLOEXEC|FAN_NONBLOCK,
- O_RDONLY|O_LARGEFILE|O_CLOEXEC|O_NOATIME);
+ fanotify_fd = fanotify_init(FAN_CLOEXEC|FAN_NONBLOCK, O_RDONLY|O_LARGEFILE|O_CLOEXEC|O_NOATIME);
if (fanotify_fd < 0) {
log_error("Failed to create fanotify object: %m");
r = -errno;
diff --git a/src/shared/ask-password-api.c b/src/shared/ask-password-api.c
index d091a22..8553066 100644
--- a/src/shared/ask-password-api.c
+++ b/src/shared/ask-password-api.c
@@ -263,8 +263,7 @@ static int create_socket(char **name) {
zero(sa);
sa.un.sun_family = AF_UNIX;
- snprintf(sa.un.sun_path, sizeof(sa.un.sun_path)-1,
- "/run/systemd/ask-password/sck.%llu", random_ull());
+ snprintf(sa.un.sun_path, sizeof(sa.un.sun_path)-1, "/run/systemd/ask-password/sck.%llu", random_ull());
u = umask(0177);
r = bind(fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + strlen(sa.un.sun_path));
commit cc1f918dda4193c7fd2a03de4ab715be67017a36
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Sun Mar 31 19:27:49 2013 -0400
units/user: default.target must be isolatable
...
Activating default unit: default.target
Default target could not be isolated, starting instead: Operation refused, unit may not be isolated.
diff --git a/TODO b/TODO
index 3bf442b..40a9914 100644
--- a/TODO
+++ b/TODO
@@ -1,4 +1,7 @@
Bugfixes:
+* systemctl completion doesn't want to start failed systemd-tmpfiles-setup.service
+ systemctl --system show -p Fr<TAB> default.target doesn't show anything
+
* systemd-journald seems to randomly hang on shutdown, likely not handling
SIGTERM, shutdown blocks until we send SIGKILL at the very end.
@@ -19,6 +22,8 @@ Bugfixes:
* suppress log output on shutdown when "quiet" is used
+* systemctl delete x.snapshot leaves no trace in logs (at least at default level).
+
Fedora 19:
* make anaconda write timeout=0 for encrypted devices
diff --git a/units/user/default.target b/units/user/default.target
index 56cf4dc..71eed51 100644
--- a/units/user/default.target
+++ b/units/user/default.target
@@ -8,3 +8,4 @@
[Unit]
Description=Default
Documentation=man:systemd.special(7)
+AllowIsolate=yes
commit fff40a51ccbb02e8dec4ff2ee505bc84f75e445c
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Sun Mar 31 18:18:10 2013 -0400
activate: do not leak envp on error
diff --git a/src/activate/activate.c b/src/activate/activate.c
index a6e7248..3ea2470 100644
--- a/src/activate/activate.c
+++ b/src/activate/activate.c
@@ -137,6 +137,11 @@ static int open_sockets(int *epoll_fd, bool accept) {
count ++;
}
+ /** Note: we leak some fd's on error here. I doesn't matter
+ * much, since the program will exit immediately anyway, but
+ * would be a pain to fix.
+ */
+
STRV_FOREACH(address, arg_listen) {
log_info("Opening address %s", *address);
@@ -166,7 +171,8 @@ static int open_sockets(int *epoll_fd, bool accept) {
static int launch(char* name, char **argv, char **env, int fds) {
unsigned n_env = 0, length;
- char **envp = NULL, **s;
+ char _cleanup_strv_free_ **envp = NULL;
+ char **s;
static const char* tocopy[] = {"TERM=", "PATH=", "USER=", "HOME="};
char _cleanup_free_ *tmp = NULL;
unsigned i;
commit fb93cf737549f2d5fce6cb76b1d5e8382c7537b8
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Sun Mar 24 20:16:00 2013 -0400
journalctl: reword error message
Sentence seemed to suggest that all three conditions must be true.
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index c96d68d..8661e5e 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -562,7 +562,7 @@ static int add_matches(sd_journal *j, char **args) {
else if (S_ISBLK(st.st_mode))
asprintf(&t, "_KERNEL_DEVICE=b%u:%u", major(st.st_rdev), minor(st.st_rdev));
else {
- log_error("File is not a device node, regular file or is not executable: %s", *i);
+ log_error("File is neither a device node, nor regular file, nor executable: %s", *i);
return -EINVAL;
}
commit 7f2c1f4dbfe00eeef072c65f81a43b3b7fb83365
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Sun Mar 31 16:29:46 2013 -0400
tmpfiles: fix obscure leak in error path
The leak was because of the single return in midst of all
'goto finish'es. Using automatic cleanup simplifies things.
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 918702e..0b168f0 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -1021,7 +1021,8 @@ static bool item_equal(Item *a, Item *b) {
}
static int parse_line(const char *fname, unsigned line, const char *buffer) {
- Item *i, *existing;
+ Item _cleanup_free_ *i = NULL;
+ Item *existing;
char _cleanup_free_
*mode = NULL, *user = NULL, *group = NULL, *age = NULL;
char type;
@@ -1047,8 +1048,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
&n);
if (r < 2) {
log_error("[%s:%u] Syntax error.", fname, line);
- r = -EIO;
- goto finish;
+ return -EIO;
}
if (n >= 0) {
@@ -1078,16 +1078,14 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
case CREATE_SYMLINK:
if (!i->argument) {
log_error("[%s:%u] Symlink file requires argument.", fname, line);
- r = -EBADMSG;
- goto finish;
+ return -EBADMSG;
}
break;
case WRITE_FILE:
if (!i->argument) {
log_error("[%s:%u] Write file requires argument.", fname, line);
- r = -EBADMSG;
- goto finish;
+ return -EBADMSG;
}
break;
@@ -1097,14 +1095,12 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
if (!i->argument) {
log_error("[%s:%u] Device file requires argument.", fname, line);
- r = -EBADMSG;
- goto finish;
+ return -EBADMSG;
}
if (sscanf(i->argument, "%u:%u", &major, &minor) != 2) {
log_error("[%s:%u] Can't parse device file major/minor '%s'.", fname, line, i->argument);
- r = -EBADMSG;
- goto finish;
+ return -EBADMSG;
}
i->major_minor = makedev(major, minor);
@@ -1113,24 +1109,20 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
default:
log_error("[%s:%u] Unknown file type '%c'.", fname, line, type);
- r = -EBADMSG;
- goto finish;
+ return -EBADMSG;
}
i->type = type;
if (!path_is_absolute(i->path)) {
log_error("[%s:%u] Path '%s' not absolute.", fname, line, i->path);
- r = -EBADMSG;
- goto finish;
+ return -EBADMSG;
}
path_kill_slashes(i->path);
- if (arg_prefix && !path_startswith(i->path, arg_prefix)) {
- r = 0;
- goto finish;
- }
+ if (arg_prefix && !path_startswith(i->path, arg_prefix))
+ return 0;
if (user && !streq(user, "-")) {
const char *u = user;
@@ -1138,7 +1130,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
r = get_user_creds(&u, &i->uid, NULL, NULL, NULL);
if (r < 0) {
log_error("[%s:%u] Unknown user '%s'.", fname, line, user);
- goto finish;
+ return r;
}
i->uid_set = true;
@@ -1150,7 +1142,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
r = get_group_creds(&g, &i->gid);
if (r < 0) {
log_error("[%s:%u] Unknown group '%s'.", fname, line, group);
- goto finish;
+ return r;
}
i->gid_set = true;
@@ -1161,8 +1153,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
if (sscanf(mode, "%o", &m) != 1) {
log_error("[%s:%u] Invalid mode '%s'.", fname, line, mode);
- r = -ENOENT;
- goto finish;
+ return -ENOENT;
}
i->mode = m;
@@ -1182,8 +1173,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
if (parse_usec(a, &i->age) < 0) {
log_error("[%s:%u] Invalid age '%s'.", fname, line, age);
- r = -EBADMSG;
- goto finish;
+ return -EBADMSG;
}
i->age_set = true;
@@ -1198,24 +1188,18 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
if (!item_equal(existing, i))
log_warning("Two or more conflicting lines for %s configured, ignoring.", i->path);
- r = 0;
- goto finish;
+ return 0;
}
r = hashmap_put(h, i->path, i);
if (r < 0) {
log_error("Failed to insert item %s: %s", i->path, strerror(-r));
- goto finish;
+ return r;
}
- i = NULL;
- r = 0;
-
-finish:
- if (i)
- item_free(i);
+ i = NULL; /* avoid cleanup */
- return r;
+ return 0;
}
static int help(void) {
More information about the systemd-commits
mailing list