572a44
From 0b344626698e0c42a7da558783d70207f8aed05e Mon Sep 17 00:00:00 2001
a4b143
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
a4b143
Date: Fri, 11 Oct 2013 19:33:36 -0400
a4b143
Subject: [PATCH] drop-ins: check return value
a4b143
a4b143
If the function failed, nothing serious would happen
a4b143
because unlink would probably return EFAULT, but this
a4b143
would obscure the real error and is a bit sloppy.
a4b143
---
a4b143
 src/core/unit.c | 3 +++
a4b143
 1 file changed, 3 insertions(+)
a4b143
a4b143
diff --git a/src/core/unit.c b/src/core/unit.c
a4b143
index 4b97710..1db7d06 100644
a4b143
--- a/src/core/unit.c
a4b143
+++ b/src/core/unit.c
a4b143
@@ -2908,6 +2908,9 @@ int unit_remove_drop_in(Unit *u, UnitSetPropertiesMode mode, const char *name) {
a4b143
                 return 0;
a4b143
 
a4b143
         r = drop_in_file(u, mode, name, &p, &q);
a4b143
+        if (r < 0)
a4b143
+                return r;
a4b143
+
a4b143
         if (unlink(q) < 0)
a4b143
                 r = errno == ENOENT ? 0 : -errno;
a4b143
         else