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;
r = mount("tmpfs", p, "tmpfs", MS_NODEV|MS_NOSUID, t);
if (r < 0) {
- log_error_errno(r, "Failed to mount per-user tmpfs directory %s: %m", p);
+ r = log_error_errno(errno, "Failed to mount per-user tmpfs directory %s: %m", p);
goto fail;
}
}
return 0;
fail:
- free(p);
+ if (p) {
+ /* Try to clean up, but ignore errors */
+ (void) rmdir(p);
+ free(p);
+ }
+
u->runtime_path = NULL;
return r;
}