[systemd-devel] [PATCH 2/2] logind: do not continue when runtime creation path fails
Philippe De Swert
philippedeswert at gmail.com
Sun Feb 8 12:21:52 PST 2015
In user_mkdir_runtime_path() there is no need to continue if the
creation of the directory fails for whatever reason, as subsequent
actions on that directory will fail anyway.
Found with Coverity. Fixes: CID#1237538
---
src/login/logind-user.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index 7b40ef5..a329457 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -322,7 +322,8 @@ static int user_mkdir_runtime_path(User *u) {
if (path_is_mount_point(p, false) <= 0) {
_cleanup_free_ char *t = NULL;
- mkdir(p, 0700);
+ if(mkdir(p, 0700) < 0)
+ goto fail;
if (mac_smack_use())
r = asprintf(&t, "mode=0700,smackfsroot=*,uid=" UID_FMT ",gid=" GID_FMT ",size=%zu", u->uid, u->gid, u->manager->runtime_dir_size);
--
2.1.4
More information about the systemd-devel
mailing list