diff options
-rw-r--r-- | libcontacts_list_contacts.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libcontacts_list_contacts.c b/libcontacts_list_contacts.c index e4794f0..fbf56ee 100644 --- a/libcontacts_list_contacts.c +++ b/libcontacts_list_contacts.c @@ -20,6 +20,16 @@ libcontacts_list_contacts(char ***idsp, const struct passwd *user) dir = opendir(dirnam); if (!dir) { + if (errno == ENOENT) { + errno = saved_errno; + new = malloc(sizeof(**idsp)); + if (new) { + *idsp = new; + **idsp = NULL; + free(dirnam); + return 0; + } + } free(dirnam); return -1; } |