From b4f0d42dd6f0dd92ab335e82dbad433dc2b9219a Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Thu, 22 May 2003 13:34:31 +0000 Subject: [PATCH] * database_sleepycat.c: added a couple of diagnostic messages to help troubleshoot problems with db-4.1.25 on Red Hat Linux 9 * room_ops.c: call mkdir() instead of system() to create a directory --- citadel/ChangeLog | 6 ++++++ citadel/database_sleepycat.c | 14 ++++++++++---- citadel/room_ops.c | 5 ++--- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 8e3d9f082..ff30e5ebe 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,9 @@ $Log$ + Revision 606.2 2003/05/22 13:34:30 ajc + * database_sleepycat.c: added a couple of diagnostic messages to help + troubleshoot problems with db-4.1.25 on Red Hat Linux 9 + * room_ops.c: call mkdir() instead of system() to create a directory + Revision 606.1 2003/05/20 01:28:50 error * citadel.c: don't truncate roomname when user is idle, in long who list; display idle time in short who list @@ -4714,3 +4719,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import + diff --git a/citadel/database_sleepycat.c b/citadel/database_sleepycat.c index b24379ce0..6a2f0be62 100644 --- a/citadel/database_sleepycat.c +++ b/citadel/database_sleepycat.c @@ -277,18 +277,23 @@ void open_databases(void) int i; char dbfilename[SIZ]; u_int32_t flags = 0; + char dbdirname[PATH_MAX]; + + getcwd(dbdirname, sizeof dbdirname); + strcat(dbdirname, "/data"); lprintf(9, "cdb_*: open_databases() starting\n"); - lprintf(5, "%s\n", db_version(NULL, NULL, NULL)); + lprintf(9, "Compiled db: %s\n", DB_VERSION_STRING); + lprintf(5, " Linked db: %s\n", db_version(NULL, NULL, NULL)); #ifdef HAVE_ZLIB - lprintf(5, "zlib compression version %s\n", zlibVersion()); + lprintf(5, "Linked zlib: %s\n", zlibVersion()); #endif /* * Silently try to create the database subdirectory. If it's * already there, no problem. */ - system("exec mkdir data 2>/dev/null"); + mkdir(dbdirname, 0700); lprintf(9, "cdb_*: Setting up DB environment\n"); db_env_set_func_yield(sched_yield); @@ -318,7 +323,8 @@ void open_databases(void) flags = DB_CREATE|DB_RECOVER|DB_INIT_MPOOL|DB_PRIVATE|DB_INIT_TXN| DB_INIT_LOCK|DB_THREAD; - ret = dbenv->open(dbenv, "./data", flags, 0); + lprintf(9, "dbenv->open(dbenv, %s, %d, 0)\n", dbdirname, flags); + ret = dbenv->open(dbenv, dbdirname, flags, 0); if (ret) { lprintf(1, "cdb_*: dbenv->open: %s\n", db_strerror(ret)); dbenv->close(dbenv, 0); diff --git a/citadel/room_ops.c b/citadel/room_ops.c index 28c6f4971..3d701b95e 100644 --- a/citadel/room_ops.c +++ b/citadel/room_ops.c @@ -1326,10 +1326,9 @@ void cmd_setr(char *args) /* Create a room directory if necessary */ if (CC->quickroom.QRflags & QR_DIRECTORY) { - snprintf(buf, sizeof buf, - "mkdir ./files/%s /dev/null 2>/dev/null", + snprintf(buf, sizeof buf, "./files/%s", CC->quickroom.QRdirname); - system(buf); + mkdir(buf, 0755); } snprintf(buf, sizeof buf, "%s> edited by %s\n", CC->quickroom.QRname, CC->curr_user); aide_message(buf); -- 2.39.2