diff options
author | Martin Pärtel <martin.partel@gmail.com> | 2020-04-13 13:16:07 +0300 |
---|---|---|
committer | Martin Pärtel <martin.partel@gmail.com> | 2020-04-13 13:16:07 +0300 |
commit | ecf2e1202a86c92f232efbaa15216f406fa3514f (patch) | |
tree | d066e624476538fcdef95347048567d0ea2de0af /src/userinfo.c | |
parent | 82050fa3e903d4c26f4277e2845a901c671d22b8 (diff) | |
download | bindfs-ecf2e1202a86c92f232efbaa15216f406fa3514f.tar.gz |
On UID/GID DB read failure, print non-debug message and tolerate ENOENT.
Diffstat (limited to 'src/userinfo.c')
-rw-r--r-- | src/userinfo.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/userinfo.c b/src/userinfo.c index b9a47e6..3adadea 100644 --- a/src/userinfo.c +++ b/src/userinfo.c @@ -114,7 +114,11 @@ static int rebuild_uid_cache() if (pw == NULL) { if (errno == 0) { break; + } else if (errno == ENOENT) { // We might have gotten some entries. This happens at least on the CentOS 8 Vagrant image (tested 2020-04-13). + fprintf(stderr, "Got ENOENT while rebuilding uid cache. The cache may be incomplete.\n"); + break; } else { + perror("Failed to rebuild uid cache"); goto error; } } @@ -136,7 +140,6 @@ static int rebuild_uid_cache() error: endpwent(); clear_uid_cache(); - DPRINTF("Failed to rebuild uid cache"); return 0; } @@ -160,7 +163,11 @@ static int rebuild_gid_cache() if (gr == NULL) { if (errno == 0) { break; + } else if (errno == ENOENT) { // We might have gotten some entries. This happens at least on the CentOS 8 Vagrant image (tested 2020-04-13). + fprintf(stderr, "Got ENOENT while rebuilding gid cache. The cache may be incomplete.\n"); + break; } else { + perror("Failed to rebuild gid cache"); goto error; } } @@ -194,7 +201,6 @@ static int rebuild_gid_cache() error: endgrent(); clear_gid_cache(); - DPRINTF("Failed to rebuild uid cache"); return 0; } |