diff options
author | Shawn Landden <shawnlandden@gmail.com> | 2012-07-25 14:55:59 -0700 |
---|---|---|
committer | Kay Sievers <kay@vrfy.org> | 2012-07-26 11:48:26 +0200 |
commit | 0d0f0c50d3a1d90f03972a6abb82e6413daaa583 (patch) | |
tree | 74f41c8455dbd78599f49300315a2569a8989992 /src/login/logind-session.c | |
parent | e146e4516b9ea9907852e7ad609de39dca9e8769 (diff) |
log.h: new log_oom() -> int -ENOMEM, use it
also a number of minor fixups and bug fixes: spelling, oom errors
that didn't print errors, not properly forwarding error codes,
few more consistency issues, et cetera
Diffstat (limited to 'src/login/logind-session.c')
-rw-r--r-- | src/login/logind-session.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/login/logind-session.c b/src/login/logind-session.c index a43ecad2b1..16d4955d5d 100644 --- a/src/login/logind-session.c +++ b/src/login/logind-session.c @@ -374,10 +374,8 @@ static int session_link_x11_socket(Session *s) { k = strspn(s->display+1, "0123456789"); f = new(char, sizeof("/tmp/.X11-unix/X") + k); - if (!f) { - log_error("Out of memory."); - return -ENOMEM; - } + if (!f) + return log_oom(); c = stpcpy(f, "/tmp/.X11-unix/X"); memcpy(c, s->display+1, k); @@ -395,9 +393,8 @@ static int session_link_x11_socket(Session *s) { t = strappend(s->user->runtime_path, "/X11-display"); if (!t) { - log_error("Out of memory."); free(f); - return -ENOMEM; + return log_oom(); } if (link(f, t) < 0) { @@ -468,10 +465,8 @@ static int session_create_cgroup(Session *s) { assert(s->user->cgroup_path); if (!s->cgroup_path) { - if (asprintf(&p, "%s/%s", s->user->cgroup_path, s->id) < 0) { - log_error("Out of memory."); - return -ENOMEM; - } + if (asprintf(&p, "%s/%s", s->user->cgroup_path, s->id) < 0) + return log_oom(); } else p = s->cgroup_path; @@ -669,10 +664,8 @@ static int session_unlink_x11_socket(Session *s) { s->user->display = NULL; t = strappend(s->user->runtime_path, "/X11-display"); - if (!t) { - log_error("Out of memory."); - return -ENOMEM; - } + if (!t) + return log_oom(); r = unlink(t); free(t); |