user-runtime-dir: error out immediately if mkdir fails
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 24 Jan 2022 09:53:00 +0000 (10:53 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Mon, 24 Jan 2022 13:06:45 +0000 (13:06 +0000)
commit4a00b45fa669faafc1ac1ec531cc106f2374e52d
tree5a85e87215bffe2d01b582578c352cbbb791c18e
parentcb94b8acc593c39bdfed83875f7d088dc04c2593
user-runtime-dir: error out immediately if mkdir fails

We try to create two directories: /run/user and /run/user/<UID>. For the
first we check the return value and error out if creation fails. But for
the second one we continued based on the assumption that the subsequent
mount will immediately fail anyway. But this has the disadvantage that we
get a somewhat confusing error message:

janv. 23 22:04:31 nsfw systemd-user-runtime-dir[1660]: Failed to mount per-user tmpfs directory /run/user/1000: No such file or directory

Let's instead fail immediately with a precise error message.

For https://bugzilla.redhat.com/show_bug.cgi?id=2044100.
src/login/user-runtime-dir.c