diff options
Diffstat (limited to 'ldap/servers/slapd/protect_db.c')
-rw-r--r-- | ldap/servers/slapd/protect_db.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/ldap/servers/slapd/protect_db.c b/ldap/servers/slapd/protect_db.c index c90c8001..ce113948 100644 --- a/ldap/servers/slapd/protect_db.c +++ b/ldap/servers/slapd/protect_db.c @@ -205,10 +205,12 @@ make_sure_dir_exists(char *dir) slapdFrontendConfig->localuserinfo != NULL) { pw = slapdFrontendConfig->localuserinfo; if (chown(dir, pw->pw_uid, -1) == -1) { - stat(dir, &stat_buffer); - if (stat_buffer.st_uid != pw->pw_uid) { + if ((stat(dir, &stat_buffer) == 0) && (stat_buffer.st_uid != pw->pw_uid)) { LDAPDebug(LDAP_DEBUG_ANY, CHOWN_WARNING, dir, 0, 0); return 1; + } else { + LDAPDebug(LDAP_DEBUG_ANY, STAT_ERROR, dir, errno, 0); + return 1; } } } @@ -242,8 +244,7 @@ add_this_process_to(char *dir_name) slapdFrontendConfig->localuserinfo != NULL) { pw = slapdFrontendConfig->localuserinfo; if (chown(file_name, pw->pw_uid, -1) == -1) { - stat(file_name, &stat_buffer); - if (stat_buffer.st_uid != pw->pw_uid) { + if ((stat(file_name, &stat_buffer) == 0) && (stat_buffer.st_uid != pw->pw_uid)) { LDAPDebug(LDAP_DEBUG_ANY, CHOWN_WARNING, file_name, 0, 0); } } |