drop-ins: check return value

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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2013-10-13 17:56:54 -04:00
parent 7ca9dffae1
commit 6891529fe1
+3
View 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