From 33ff8959db477c7353a0ccf44348f17763f83bd4 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 6 Apr 2021 13:48:08 +0200 Subject: Do not create the home directory if missing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- add-contact.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/add-contact.c b/add-contact.c index 5a1b68c..843eb73 100644 --- a/add-contact.c +++ b/add-contact.c @@ -21,6 +21,10 @@ main(int argc, char *argv[]) user = getpwuid(getuid()); if (!user) eprintf("getpwuid: %s\n", errno ? strerror(errno) : "user does not exist"); + if (!user->pw_dir || !*user->pw_dir) + eprintf("user does not have a home directory\n"); + if (access(user->pw_dir, R_OK | W_OK | X_OK)) + eprintf("access %s R_OK|W_OK|X_OK:", user->pw_dir); if (argc) { path = libcontacts_get_path(argv[0], user); -- cgit v1.2.3-70-g09d2