anitazha / rpms / systemd

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