]> code.citadel.org Git - citadel.git/blobdiff - citadel/database.c
Changing the name of the 'Aide' access level to 'Admin'
[citadel.git] / citadel / database.c
index 83e2dfe2fd2f27d6729181b7f2289a8c91dd4660..cdc732cdc8082e90d197d861bdc35889c549942f 100644 (file)
@@ -222,7 +222,7 @@ static void cdb_cull_logs(void)
 void cmd_cull(char *argbuf) {
        if (CtdlAccessCheck(ac_internal)) return;
        cdb_cull_logs();
-       cprintf("%d Database log file cull completed.", CIT_OK);
+       cprintf("%d Database log file cull completed.\n", CIT_OK);
 }
 
 
@@ -396,7 +396,7 @@ void open_databases(void)
                if (ret) {
                        syslog(LOG_EMERG, "db_open[%02x]: %s\n", i, db_strerror(ret));
                        if (ret == ENOMEM) {
-                               syslog(LOG_EMERG, "You may need to tune your database; please read http://www.citadel.org/doku.php/faq:troubleshooting:out_of_lock_entries for more information.\n");
+                               syslog(LOG_EMERG, "You may need to tune your database; please read http://www.citadel.org/doku.php?id=faq:troubleshooting:out_of_lock_entries for more information.");
                        }
                        syslog(LOG_EMERG, "exit code %d\n", ret);
                        exit(CTDLEXIT_DB);
@@ -526,7 +526,7 @@ void cdb_decompress_if_necessary(struct cdbdata *cdb)
  * Store a piece of data.  Returns 0 if the operation was successful.  If a
  * key already exists it should be overwritten.
  */
-int cdb_store(int cdb, void *ckey, int ckeylen, void *cdata, int cdatalen)
+int cdb_store(int cdb, const void *ckey, int ckeylen, void *cdata, int cdatalen)
 {
 
        DBT dkey, ddata;
@@ -542,7 +542,9 @@ int cdb_store(int cdb, void *ckey, int ckeylen, void *cdata, int cdatalen)
        memset(&dkey, 0, sizeof(DBT));
        memset(&ddata, 0, sizeof(DBT));
        dkey.size = ckeylen;
+       /* no, we don't care for this error. */
        dkey.data = ckey;
+
        ddata.size = cdatalen;
        ddata.data = cdata;
 
@@ -680,15 +682,15 @@ static DBC *localcursor(int cdb)
  * a struct cdbdata which it is the caller's responsibility to free later on
  * using the cdb_free() routine.
  */
-struct cdbdata *cdb_fetch(int cdb, void *key, int keylen)
+struct cdbdata *cdb_fetch(int cdb, const void *key, int keylen)
 {
-
        struct cdbdata *tempcdb;
        DBT dkey, dret;
        int ret;
 
        memset(&dkey, 0, sizeof(DBT));
        dkey.size = keylen;
+       /* no we don't care about this error. */
        dkey.data = key;
 
        if (TSD->tid != NULL) {
@@ -723,12 +725,15 @@ struct cdbdata *cdb_fetch(int cdb, void *key, int keylen)
        if (tempcdb == NULL) {
                syslog(LOG_EMERG, "cdb_fetch: Cannot allocate memory for tempcdb\n");
                cdb_abort();
+               return NULL; /* make it easier for static analysis... */
+       }
+       else
+       {
+               tempcdb->len = dret.size;
+               tempcdb->ptr = dret.data;
+               cdb_decompress_if_necessary(tempcdb);
+               return (tempcdb);
        }
-
-       tempcdb->len = dret.size;
-       tempcdb->ptr = dret.data;
-       cdb_decompress_if_necessary(tempcdb);
-       return (tempcdb);
 }
 
 
@@ -768,7 +773,7 @@ void cdb_rewind(int cdb)
 
        if (TSD->cursors[cdb] != NULL) {
                syslog(LOG_EMERG,
-                       "cdb_rewind: must close cursor on database %d before reopening.\n", cdb);
+                      "cdb_rewind: must close cursor on database %d before reopening.\n", cdb);
                cdb_abort();
                /* cclose(TSD->cursors[cdb]); */
        }
@@ -889,7 +894,7 @@ void cdb_trunc(int cdb)
                        } else {
                                syslog(LOG_EMERG, "cdb_truncate(%d): %s\n", cdb, db_strerror(ret));
                                if (ret == ENOMEM) {
-                                       syslog(LOG_EMERG, "You may need to tune your database; please read http://www.citadel.org/doku.php/faq:troubleshooting:out_of_lock_entries for more information.");
+                                       syslog(LOG_EMERG, "You may need to tune your database; please read http://www.citadel.org/doku.php?id=faq:troubleshooting:out_of_lock_entries for more information.");
                                }
                                exit(CTDLEXIT_DB);
                        }