diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-12-07 12:57:31 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-12-15 14:57:07 +0100 |
commit | f52da59548fac369e47cff73851c54a90cb0077c (patch) | |
tree | e64fd085b7537a72b2bb5d267da36225acd31fc6 /src | |
parent | a1b2c92d8290c76a29ccd0887a92ac064e1bb5a1 (diff) | |
download | systemd-f52da59548fac369e47cff73851c54a90cb0077c.tar.gz systemd-f52da59548fac369e47cff73851c54a90cb0077c.tar.bz2 systemd-f52da59548fac369e47cff73851c54a90cb0077c.zip |
logind: simplify one conditional
Don't bother with removing the directory if we didn't create it.
Diffstat (limited to 'src')
-rw-r--r-- | src/login/logind-user.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/login/logind-user.c b/src/login/logind-user.c index 94e250b94a..f17bc26f14 100644 --- a/src/login/logind-user.c +++ b/src/login/logind-user.c @@ -344,16 +344,13 @@ static int user_mkdir_runtime_path(User *u) { if (path_is_mount_point(u->runtime_path, NULL, 0) <= 0) { _cleanup_free_ char *t = NULL; - (void) mkdir_label(u->runtime_path, 0700); + r = asprintf(&t, "mode=0700,uid=" UID_FMT ",gid=" GID_FMT ",size=%zu%s", + u->uid, u->gid, u->manager->runtime_dir_size, + mac_smack_use() ? ",smackfsroot=*" : ""); + if (r < 0) + return log_oom(); - 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); - else - r = asprintf(&t, "mode=0700,uid=" UID_FMT ",gid=" GID_FMT ",size=%zu", u->uid, u->gid, u->manager->runtime_dir_size); - if (r < 0) { - r = log_oom(); - goto fail; - } + (void) mkdir_label(u->runtime_path, 0700); r = mount("tmpfs", u->runtime_path, "tmpfs", MS_NODEV|MS_NOSUID, t); if (r < 0) { |