anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone
572a44
From 472b443a7e1949f6d35d5216b6323424719d1b8c Mon Sep 17 00:00:00 2001
572a44
From: Djalal Harouni <tixxdz@opendz.org>
572a44
Date: Tue, 5 Nov 2013 15:26:37 +0100
572a44
Subject: [PATCH] nspawn: log out of memory errors
572a44
572a44
---
572a44
 src/nspawn/nspawn.c | 7 +++++--
572a44
 1 file changed, 5 insertions(+), 2 deletions(-)
572a44
572a44
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
572a44
index 9616dbf..db47fbd 100644
572a44
--- a/src/nspawn/nspawn.c
572a44
+++ b/src/nspawn/nspawn.c
572a44
@@ -224,6 +224,9 @@ static int parse_argv(int argc, char *argv[]) {
572a44
 
572a44
                 case 'S':
572a44
                         arg_slice = strdup(optarg);
572a44
+                        if (!arg_slice)
572a44
+                                return log_oom();
572a44
+
572a44
                         break;
572a44
 
572a44
                 case 'M':
572a44
@@ -315,11 +318,11 @@ static int parse_argv(int argc, char *argv[]) {
572a44
 
572a44
                         r = strv_extend(x, a);
572a44
                         if (r < 0)
572a44
-                                return r;
572a44
+                                return log_oom();
572a44
 
572a44
                         r = strv_extend(x, b);
572a44
                         if (r < 0)
572a44
-                                return r;
572a44
+                                return log_oom();
572a44
 
572a44
                         break;
572a44
                 }