X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fdatabase_sleepycat.c;h=918b6d415f9c6db1de8eba55351c88ceeb159e56;hb=5faa31044eeb42801e4ac7db566b686f0d7a5477;hp=cfa60460a54cca3b3bbf43ca2d5dfa0c0c5e1878;hpb=2ea2a7d64e158dfccb3e90a6b6d45647eed7323e;p=citadel.git diff --git a/citadel/database_sleepycat.c b/citadel/database_sleepycat.c index cfa60460a..918b6d415 100644 --- a/citadel/database_sleepycat.c +++ b/citadel/database_sleepycat.c @@ -343,9 +343,6 @@ void open_databases(void) int i; char dbfilename[SIZ]; u_int32_t flags = 0; - DIR *dp; - struct dirent *d; - char filename[PATH_MAX]; lprintf(CTDL_DEBUG, "cdb_*: open_databases() starting\n"); lprintf(CTDL_DEBUG, "Compiled db: %s\n", DB_VERSION_STRING); @@ -452,18 +449,29 @@ void open_databases(void) } cdb_allocate_tsd(); +} + + +/* Make sure we own all the files, because in a few milliseconds + * we're going to drop root privs. + */ +void cdb_chmod_data(void) { + DIR *dp; + struct dirent *d; + char filename[PATH_MAX]; - /* Now make sure we own all the files, because in a few milliseconds - * we're going to drop root privs. - */ dp = opendir(ctdl_data_dir); if (dp != NULL) { while (d = readdir(dp), d != NULL) { if (d->d_name[0] != '.') { snprintf(filename, sizeof filename, "%s/%s", ctdl_data_dir, d->d_name); - chmod(filename, 0600); - chown(filename, CTDLUID, (-1)); + lprintf(9, "chmod(%s, 0600) returned %d\n", + filename, chmod(filename, 0600) + ); + lprintf(9, "chown(%s, CTDLUID, -1) returned %d\n", + filename, chown(filename, CTDLUID, (-1)) + ); } } closedir(dp);