Skip to content

Commit

Permalink
fix dereferenced calls to open() and close()
Browse files Browse the repository at this point in the history
  • Loading branch information
ksmurchison committed Aug 15, 2007
1 parent e2c4d6d commit a470550
Show file tree
Hide file tree
Showing 19 changed files with 83 additions and 83 deletions.
6 changes: 3 additions & 3 deletions cyrus/imap/annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
*
*/
/*
* $Id: annotate.c,v 1.35 2007/02/05 18:41:45 jeaton Exp $
* $Id: annotate.c,v 1.36 2007/08/15 17:20:55 murch Exp $
*/

#include <config.h>
Expand Down Expand Up @@ -253,7 +253,7 @@ void annotatemore_open(char *fname)
strcat(fname, FNAME_ANNOTATIONS);
}

ret = DB->open(fname, CYRUSDB_CREATE, &anndb);
ret = (DB->open)(fname, CYRUSDB_CREATE, &anndb);
if (ret != 0) {
syslog(LOG_ERR, "DBERROR: opening %s: %s", fname,
cyrusdb_strerror(ret));
Expand All @@ -270,7 +270,7 @@ void annotatemore_close(void)
int r;

if (annotate_dbopen) {
r = DB->close(anndb);
r = (DB->close)(anndb);
if (r) {
syslog(LOG_ERR, "DBERROR: error closing annotations: %s",
cyrusdb_strerror(r));
Expand Down
10 changes: 5 additions & 5 deletions cyrus/imap/arbitron.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

/* $Id: arbitron.c,v 1.43 2007/03/30 18:40:20 murch Exp $ */
/* $Id: arbitron.c,v 1.44 2007/08/15 17:20:55 murch Exp $ */

#include <config.h>

Expand Down Expand Up @@ -419,14 +419,14 @@ void process_seen(const char *path, const char *user)
int r;
struct db *tmp = NULL;

r = DB->open(path, 0, &tmp);
r = (DB->open)(path, 0, &tmp);
if(r) goto done;

DB->foreach(tmp, "", 0, process_user_p, process_user_cb,
(void *) user, NULL);

done:
if(tmp) DB->close(tmp);
if(tmp) (DB->close)(tmp);
}

static int process_subs_cb(void *rockp __attribute__((unused)),
Expand Down Expand Up @@ -475,14 +475,14 @@ void process_subs(const char *path, const char *user)
int r;
struct db *tmp = NULL;

r = SUBDB->open(path, 0, &tmp);
r = (SUBDB->open)(path, 0, &tmp);
if(r) goto done;

SUBDB->foreach(tmp, "", 0, process_subs_p, process_subs_cb,
(void *) user, NULL);

done:
if(tmp) SUBDB->close(tmp);
if(tmp) (SUBDB->close)(tmp);
}

void report_users(struct user_list *u)
Expand Down
10 changes: 5 additions & 5 deletions cyrus/imap/cvt_cyrusdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
*
*/
/*
* $Id: cvt_cyrusdb.c,v 1.16 2006/11/30 17:11:17 murch Exp $
* $Id: cvt_cyrusdb.c,v 1.17 2007/08/15 17:20:55 murch Exp $
*/

#include <config.h>
Expand Down Expand Up @@ -157,10 +157,10 @@ int main(int argc, char *argv[])
printf("Converting from %s (%s) to %s (%s)\n", old_db, DB_OLD->name,
new_db, DB_NEW->name);

r = DB_OLD->open(old_db, 0, &odb);
r = (DB_OLD->open)(old_db, 0, &odb);
if(r != CYRUSDB_OK)
fatal("can't open old database", EC_TEMPFAIL);
r = DB_NEW->open(new_db, CYRUSDB_CREATE, &ndb);
r = (DB_NEW->open)(new_db, CYRUSDB_CREATE, &ndb);
if(r != CYRUSDB_OK)
fatal("can't open new database", EC_TEMPFAIL);

Expand All @@ -173,8 +173,8 @@ int main(int argc, char *argv[])
fprintf(stderr, "Warning: apparently empty database converted.\n");


DB_OLD->close(odb);
DB_NEW->close(ndb);
(DB_OLD->close)(odb);
(DB_NEW->close)(ndb);

cyrus_done();

Expand Down
6 changes: 3 additions & 3 deletions cyrus/imap/cyr_dbtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
*
*/
/*
* $Id: cyr_dbtool.c,v 1.1 2007/01/09 17:41:35 murch Exp $
* $Id: cyr_dbtool.c,v 1.2 2007/08/15 17:20:55 murch Exp $
*/

#include <config.h>
Expand Down Expand Up @@ -203,7 +203,7 @@ int main(int argc, char *argv[])
cyrus_init(alt_config, "cyr_dbtool", 0);


r = DB_OLD->open(old_db, db_flags, &odb);
r = (DB_OLD->open)(old_db, db_flags, &odb);
if(r != CYRUSDB_OK)
fatal("can't open database", EC_TEMPFAIL);

Expand Down Expand Up @@ -250,7 +250,7 @@ int main(int argc, char *argv[])
printf("Unknown action %s\n", action);
}

DB_OLD->close(odb);
(DB_OLD->close)(odb);

cyrus_done();

Expand Down
6 changes: 3 additions & 3 deletions cyrus/imap/duplicate.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
*
*/

/* $Id: duplicate.c,v 1.43 2007/02/14 13:29:02 murch Exp $ */
/* $Id: duplicate.c,v 1.44 2007/08/15 17:20:55 murch Exp $ */

#include <config.h>

Expand Down Expand Up @@ -105,7 +105,7 @@ int duplicate_init(char *fname, int myflags __attribute__((unused)))
strcat(fname, FNAME_DELIVERDB);
}

r = DB->open(fname, CYRUSDB_CREATE, &dupdb);
r = (DB->open)(fname, CYRUSDB_CREATE, &dupdb);
if (r != 0)
syslog(LOG_ERR, "DBERROR: opening %s: %s", fname,
cyrusdb_strerror(r));
Expand Down Expand Up @@ -395,7 +395,7 @@ int duplicate_done(void)
int r = 0;

if (duplicate_dbopen) {
r = DB->close(dupdb);
r = (DB->close)(dupdb);
if (r) {
syslog(LOG_ERR, "DBERROR: error closing deliverdb: %s",
cyrusdb_strerror(r));
Expand Down
6 changes: 3 additions & 3 deletions cyrus/imap/fetchnews.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $Id: fetchnews.c,v 1.17 2007/03/30 18:40:20 murch Exp $
* $Id: fetchnews.c,v 1.18 2007/08/15 17:20:55 murch Exp $
*/

#include <config.h>
Expand Down Expand Up @@ -94,7 +94,7 @@ int newsrc_init(char *fname, int myflags __attribute__((unused)))
strcat(fname, FNAME_NEWSRCDB);
}

r = DB->open(fname, CYRUSDB_CREATE, &newsrc_db);
r = (DB->open)(fname, CYRUSDB_CREATE, &newsrc_db);
if (r != 0)
syslog(LOG_ERR, "DBERROR: opening %s: %s", fname,
cyrusdb_strerror(r));
Expand All @@ -112,7 +112,7 @@ int newsrc_done(void)
int r = 0;

if (newsrc_dbopen) {
r = DB->close(newsrc_db);
r = (DB->close)(newsrc_db);
if (r) {
syslog(LOG_ERR, "DBERROR: error closing fetchnews.db: %s",
cyrusdb_strerror(r));
Expand Down
18 changes: 9 additions & 9 deletions cyrus/imap/mboxkey.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* mboxkey.c -- implementation of URLAUTH mailbox keys
* $Id: mboxkey.c,v 1.3 2007/03/27 19:53:09 murch Exp $
* $Id: mboxkey.c,v 1.4 2007/08/15 17:20:55 murch Exp $
*
* Copyright (c) 1998-2005 Carnegie Mellon University. All rights reserved.
*
Expand Down Expand Up @@ -150,7 +150,7 @@ int mboxkey_open(const char *user,
/* otherwise, close the existing database */
if (mboxkeydb) {
abortcurrent(mboxkeydb);
r = DB->close(mboxkeydb->db);
r = (DB->close)(mboxkeydb->db);
if (r) {
syslog(LOG_ERR, "DBERROR: error closing mboxkeydb: %s",
cyrusdb_strerror(r));
Expand All @@ -164,7 +164,7 @@ int mboxkey_open(const char *user,

/* open the mboxkeydb corresponding to user */
fname = mboxkey_getpath(user);
r = DB->open(fname, (flags & MBOXKEY_CREATE) ? CYRUSDB_CREATE : 0,
r = (DB->open)(fname, (flags & MBOXKEY_CREATE) ? CYRUSDB_CREATE : 0,
&mboxkeydb->db);
if (r != 0) {
int level = (flags & MBOXKEY_CREATE) ? LOG_ERR : LOG_DEBUG;
Expand Down Expand Up @@ -325,7 +325,7 @@ int mboxkey_close(struct mboxkey *mboxkeydb)

/* free the old database hanging around */
abortcurrent(lastmboxkey);
r = DB->close(lastmboxkey->db);
r = (DB->close)(lastmboxkey->db);
if (r != CYRUSDB_OK) {
syslog(LOG_ERR, "DBERROR: error closing lastmboxkey: %s",
cyrusdb_strerror(r));
Expand Down Expand Up @@ -409,7 +409,7 @@ int mboxkey_done(void)

if (lastmboxkey) {
abortcurrent(lastmboxkey);
r = DB->close(lastmboxkey->db);
r = (DB->close)(lastmboxkey->db);
if (r) {
syslog(LOG_ERR, "DBERROR: error closing lastmboxkey: %s",
cyrusdb_strerror(r));
Expand Down Expand Up @@ -482,10 +482,10 @@ int mboxkey_merge(const char *tmpfile, const char *tgtfile)
struct mboxkey_merge_rock rock;

/* xxx does this need to be CYRUSDB_CREATE? */
r = DB->open(tmpfile, CYRUSDB_CREATE, &tmp);
r = (DB->open)(tmpfile, CYRUSDB_CREATE, &tmp);
if(r) goto done;

r = DB->open(tgtfile, CYRUSDB_CREATE, &tgt);
r = (DB->open)(tgtfile, CYRUSDB_CREATE, &tgt);
if(r) goto done;

rock.db = tgt;
Expand All @@ -498,8 +498,8 @@ int mboxkey_merge(const char *tmpfile, const char *tgtfile)

done:

if(tgt) DB->close(tgt);
if(tmp) DB->close(tmp);
if(tgt) (DB->close)(tgt);
if(tmp) (DB->close)(tmp);

return r;
}
10 changes: 5 additions & 5 deletions cyrus/imap/mboxlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
*
*/
/*
* $Id: mboxlist.c,v 1.247 2007/03/27 19:53:09 murch Exp $
* $Id: mboxlist.c,v 1.248 2007/08/15 17:20:55 murch Exp $
*/

#include <config.h>
Expand Down Expand Up @@ -2722,7 +2722,7 @@ void mboxlist_open(char *fname)
flags |= CYRUSDB_MBOXSORT;
}

ret = DB->open(fname, flags, &mbdb);
ret = (DB->open)(fname, flags, &mbdb);
if (ret != 0) {
syslog(LOG_ERR, "DBERROR: opening %s: %s", fname,
cyrusdb_strerror(ret));
Expand All @@ -2741,7 +2741,7 @@ void mboxlist_close(void)
int r;

if (mboxlist_dbopen) {
r = DB->close(mbdb);
r = (DB->close)(mbdb);
if (r) {
syslog(LOG_ERR, "DBERROR: error closing mailboxes: %s",
cyrusdb_strerror(r));
Expand Down Expand Up @@ -2801,7 +2801,7 @@ mboxlist_opensubs(const char *userid,
flags |= CYRUSDB_MBOXSORT;
}

r = SUBDB->open(subsfname, flags, ret);
r = (SUBDB->open)(subsfname, flags, ret);
if (r != CYRUSDB_OK) {
r = IMAP_IOERROR;
}
Expand All @@ -2815,7 +2815,7 @@ mboxlist_opensubs(const char *userid,
*/
static void mboxlist_closesubs(struct db *sub)
{
SUBDB->close(sub);
(SUBDB->close)(sub);
}

/*
Expand Down
6 changes: 3 additions & 3 deletions cyrus/imap/quota_db.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $Id: quota_db.c,v 1.6 2007/07/10 19:20:30 murch Exp $
* $Id: quota_db.c,v 1.7 2007/08/15 17:20:57 murch Exp $
*
*/

Expand Down Expand Up @@ -251,7 +251,7 @@ void quotadb_open(char *fname)
strlcat(fname, FNAME_QUOTADB, fname_len);
}

ret = QDB->open(fname, CYRUSDB_CREATE, &qdb);
ret = (QDB->open)(fname, CYRUSDB_CREATE, &qdb);
if (ret != 0) {
syslog(LOG_ERR, "DBERROR: opening %s: %s", fname,
cyrusdb_strerror(ret));
Expand All @@ -270,7 +270,7 @@ void quotadb_close(void)
int r;

if (quota_dbopen) {
r = QDB->close(qdb);
r = (QDB->close)(qdb);
if (r) {
syslog(LOG_ERR, "DBERROR: error closing quotas: %s",
cyrusdb_strerror(r));
Expand Down
6 changes: 3 additions & 3 deletions cyrus/imap/seen_bigdb.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* seen_bigdb.c -- implementation of seen database using one big cyrusdb
* $Id: seen_bigdb.c,v 1.11 2006/11/30 17:11:20 murch Exp $
* $Id: seen_bigdb.c,v 1.12 2007/08/15 17:20:57 murch Exp $
* Copyright (c) 1998-2003 Carnegie Mellon University. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -104,7 +104,7 @@ static void seen_init(void)
strcpy(fname, config_dir);
strcat(fname, FNAME_SEENDB);

r = DB->open(fname, CYRUSDB_CREATE, &bigdb);
r = (DB->open)(fname, CYRUSDB_CREATE, &bigdb);
if (r != 0) {
syslog(LOG_ERR, "DBERROR: opening %s: %s", fname,
cyrusdb_strerror(r));
Expand Down Expand Up @@ -385,7 +385,7 @@ int seen_done(void)
int r;

if (seen_inited) {
r = DB->close(bigdb);
r = (DB->close)(bigdb);
if (r != 0) {
syslog(LOG_ERR, "DBERROR: closing seen database: %s",
cyrusdb_strerror(r));
Expand Down
Loading

0 comments on commit a470550

Please sign in to comment.