chiark / gitweb /
drop-ins: check return value
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 11 Oct 2013 23:33:36 +0000 (19:33 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 13 Oct 2013 21:56:54 +0000 (17:56 -0400)
If the function failed, nothing serious would happen
because unlink would probably return EFAULT, but this
would obscure the real error and is a bit sloppy.

src/core/unit.c

index 4b9771076aa36539a7ff1423094b19322c299c37..1db7d061c4d46437f98a5808c88b3ef0bb1c8272 100644 (file)
@@ -2908,6 +2908,9 @@ int unit_remove_drop_in(Unit *u, UnitSetPropertiesMode mode, const char *name) {
                 return 0;
 
         r = drop_in_file(u, mode, name, &p, &q);
+        if (r < 0)
+                return r;
+
         if (unlink(q) < 0)
                 r = errno == ENOENT ? 0 : -errno;
         else