summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2015-08-14 13:31:36 +0200
committerDaniel Mack <github@zonque.org>2015-08-14 13:31:36 +0200
commit6c269e640209451808438654ec41498d9eb25046 (patch)
treec7791b3e3d6f56dcfc32ee93567d15e0cd704b84
parentc5974b33e7fa3b777e72181d0fc0d1d22fdab2cd (diff)
parent88231eb62cafc8bb51406919c8cf6019dc1ac916 (diff)
Merge pull request #948 from phomes/master
logind: actually fail on OOM
-rw-r--r--src/login/logind-inhibit.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/login/logind-inhibit.c b/src/login/logind-inhibit.c
index a261e6a719..cfae186edd 100644
--- a/src/login/logind-inhibit.c
+++ b/src/login/logind-inhibit.c
@@ -109,20 +109,24 @@ int inhibitor_save(Inhibitor *i) {
_cleanup_free_ char *cc = NULL;
cc = cescape(i->who);
- if (!cc)
+ if (!cc) {
r = -ENOMEM;
- else
- fprintf(f, "WHO=%s\n", cc);
+ goto fail;
+ }
+
+ fprintf(f, "WHO=%s\n", cc);
}
if (i->why) {
_cleanup_free_ char *cc = NULL;
cc = cescape(i->why);
- if (!cc)
+ if (!cc) {
r = -ENOMEM;
- else
- fprintf(f, "WHY=%s\n", cc);
+ goto fail;
+ }
+
+ fprintf(f, "WHY=%s\n", cc);
}
if (i->fifo_path)