ask-password-api: don't accidentally create a dir, when we don't want one
authorLennart Poettering <lennart@poettering.net>
Fri, 18 Oct 2024 19:36:34 +0000 (21:36 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 21 Oct 2024 12:14:16 +0000 (14:14 +0200)
commit2ee6fa552eb802baf901983b556b3e7f8ad60f1e
tree870206cac4a4321a3e272f907818c4a66d5b3710
parentf4c3bafd10a146ee1abd5e69be2aec9174bfcf80
ask-password-api: don't accidentally create a dir, when we don't want one

Previously, we were using touch(), which usually works fine, because the
path should always refer to an existing directory, in which case it just
updates the timestamp. However, if the dir does not exist yet (which
shouldn't happen), it would be created as regular file, which is just
wrong.

Hence, let's instead create the dir as dir if it is missing, and then
update its timestamp.
src/basic/fs-util.c
src/basic/fs-util.h
src/shared/ask-password-api.c