moved whitespace around
[citadel.git] / citadel / server / backends / common / database.c
index e3024f4d1919573ecf080a3f0b568733efaaa467..67022f7436335f98af9ba1d9400ecd3c86247fa5 100644 (file)
@@ -1,6 +1,6 @@
 // Copyright (c) 1987-2023 by the citadel.org team
 // This program is open source software.  Use, duplication, or disclosure
-// are subject to the terms of the GNU General Public License, version 3.
+// is subject to the terms of the GNU General Public License, version 3.
 
 // The functions in this file handle the selection and activation of a storage backend for Citadel Server.
 // Right now, it simply activates Berkeley DB because that's the only one we have.
@@ -56,28 +56,33 @@ void cdb_chmod_data(void) {
 
        // Silently try to create the database subdirectory.  If it's already there, no problem.
        if ((mkdir(ctdl_db_dir, 0700) != 0) && (errno != EEXIST)) {
-               syslog(LOG_ERR, "bdb: database directory [%s] does not exist and could not be created: %m", ctdl_db_dir);
+               syslog(LOG_ERR, "db: database directory [%s] does not exist and could not be created: %m", ctdl_db_dir);
                exit(CTDLEXIT_DB);
        }
        if (chmod(ctdl_db_dir, 0700) != 0) {
-               syslog(LOG_ERR, "bdb: unable to set database directory permissions [%s]: %m", ctdl_db_dir);
+               syslog(LOG_ERR, "db: unable to set database directory permissions [%s]: %m", ctdl_db_dir);
                exit(CTDLEXIT_DB);
        }
        if (chown(ctdl_db_dir, ctdluid, (-1)) != 0) {
-               syslog(LOG_ERR, "bdb: unable to set the owner for [%s]: %m", ctdl_db_dir);
+               syslog(LOG_ERR, "db: unable to set the owner for [%s]: %m", ctdl_db_dir);
                exit(CTDLEXIT_DB);
        }
        dp = opendir(ctdl_db_dir);
        if (dp != NULL) {
                while (d = readdir(dp), d != NULL) {
                        if (d->d_name[0] != '.') {
+                               int ret;
                                snprintf(filename, sizeof filename, "%s/%s", ctdl_db_dir, d->d_name);
-                               syslog(LOG_DEBUG, "bdb: chmod(%s, 0600) returned %d", filename, chmod(filename, 0600));
-                               syslog(LOG_DEBUG, "bdb: chown(%s, ctdluid, -1) returned %d", filename, chown(filename, ctdluid, (-1)));
+                               ret = chmod(filename, 0600);
+                               if (ret != 0) {
+                                       syslog(LOG_DEBUG, "db: chmod(%s, 0600) returned %d", filename, ret);
+                               }
+                               ret = chown(filename, ctdluid, (-1));
+                               if (ret != 0) {
+                                       syslog(LOG_DEBUG, "db: chown(%s, ctdluid, -1) returned %d", filename, ret);
+                               }
                        }
                }
                closedir(dp);
        }
 }
-
-