aboutsummaryrefslogtreecommitdiffstats
path: root/add-contact.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-04-06 13:48:08 +0200
committerMattias Andrée <maandree@kth.se>2021-04-06 13:48:08 +0200
commit33ff8959db477c7353a0ccf44348f17763f83bd4 (patch)
treeaf7b16aedef6dc62f7913a4c39239347c1f0f2f3 /add-contact.c
parentSwap install rule in multicall-symlinks.mk amd singlecall.mk so it is as intended (diff)
downloadcontacts-33ff8959db477c7353a0ccf44348f17763f83bd4.tar.gz
contacts-33ff8959db477c7353a0ccf44348f17763f83bd4.tar.bz2
contacts-33ff8959db477c7353a0ccf44348f17763f83bd4.tar.xz
Do not create the home directory if missing
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'add-contact.c')
-rw-r--r--add-contact.c4
1 files changed, 4 insertions, 0 deletions
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);