2
0
mirror of https://github.com/vdukhovni/postfix synced 2025-08-31 14:17:41 +00:00

snapshot-20001030

This commit is contained in:
Wietse Venema
2000-10-30 00:00:00 -05:00
committed by Viktor Dukhovni
parent 0a906a1db4
commit 5583b224b4
4 changed files with 32 additions and 9 deletions

View File

@@ -4418,3 +4418,9 @@ Apologies for any names omitted.
Feature: added UNIX-domain support to the smtpstone test
programs in order to test the LMTP client UNIX-domain
support.
20001039
Bugfix: further testing in preparation for 19991231-pl10
revealed that the DB map code was now broken for every
platform.

View File

@@ -15,7 +15,7 @@
* Version of this program.
*/
#define VAR_MAIL_VERSION "mail_version"
#define DEF_MAIL_VERSION "Snapshot-20001029"
#define DEF_MAIL_VERSION "Snapshot-20001030"
extern char *var_mail_version;
/* LICENSE

View File

@@ -122,9 +122,9 @@ static int sanitize(int status)
*/
switch (status) {
case DB_NOTFOUND: /* get, del */
case DB_KEYEXIST: /* put */
return (1); /* non-fatal */
case DB_NOTFOUND: /* get, del */
case DB_KEYEXIST: /* put */
return (1); /* non-fatal */
case 0:
return (0); /* success */
@@ -313,6 +313,9 @@ static int dict_db_delete(DICT *dict, const char *name)
if (status == 0)
dict->flags &= ~DICT_FLAG_TRY1NULL;
}
if (dict->flags & DICT_FLAG_SYNC_UPDATE)
if (DICT_DB_SYNC(db, 0) < 0)
msg_fatal("%s: flush dictionary: %m", dict_db->path);
/*
* Release the exclusive lock.
@@ -421,6 +424,7 @@ static DICT *dict_db_open(const char *path, int open_flags, int type,
DB *db;
char *db_path;
int lock_fd = -1;
int dbfd;
#if DB_VERSION_MAJOR > 1
int db_flags;
@@ -429,6 +433,13 @@ static DICT *dict_db_open(const char *path, int open_flags, int type,
db_path = concatenate(path, ".db", (char *) 0);
if (dict_flags & DICT_FLAG_LOCK) {
if ((lock_fd = open(db_path, open_flags, 0644)) < 0)
msg_fatal("open database %s: %m", db_path);
if (myflock(lock_fd, MYFLOCK_SHARED) < 0)
msg_fatal("shared-lock database %s for open: %m", db_path);
}
/*
* Use the DB 1.x programming interface. This is the default interface
* with 4.4BSD systems. It is also available via the db_185 compatibility
@@ -438,7 +449,7 @@ static DICT *dict_db_open(const char *path, int open_flags, int type,
#if DB_VERSION_MAJOR < 2
if ((db = dbopen(db_path, open_flags, 0644, type, tweak)) == 0)
msg_fatal("open database %s: %m", db_path);
lock_fd = db->fd(db);
dbfd = db->fd(db);
#endif
/*
@@ -456,7 +467,7 @@ static DICT *dict_db_open(const char *path, int open_flags, int type,
msg_fatal("open database %s: %m", db_path);
if (db == 0)
msg_panic("db_open null result");
if ((errno = db->fd(db, &lock_fd)) != 0)
if ((errno = db->fd(db, &dbfd)) != 0)
msg_fatal("get database file descriptor: %m");
#endif
@@ -481,9 +492,15 @@ static DICT *dict_db_open(const char *path, int open_flags, int type,
msg_fatal("set DB hash element count %d: %m", DICT_DB_NELM);
if ((errno = db->open(db, db_path, 0, type, db_flags, 0644)) != 0)
msg_fatal("open database %s: %m", db_path);
if ((errno = db->fd(db, &lock_fd)) != 0)
if ((errno = db->fd(db, &dbfd)) != 0)
msg_fatal("get database file descriptor: %m");
#endif
if (dict_flags & DICT_FLAG_LOCK) {
if (myflock(lock_fd, MYFLOCK_NONE) < 0)
msg_fatal("unlock database %s for open: %m", db_path);
if (close(lock_fd) < 0)
msg_fatal("close database %s: %m", db_path);
}
dict_db = (DICT_DB *) mymalloc(sizeof(*dict_db));
dict_db->dict.lookup = dict_db_lookup;
@@ -491,7 +508,7 @@ static DICT *dict_db_open(const char *path, int open_flags, int type,
dict_db->dict.delete = dict_db_delete;
dict_db->dict.sequence = dict_db_sequence;
dict_db->dict.close = dict_db_close;
dict_db->dict.fd = lock_fd;
dict_db->dict.fd = dbfd;
if (fstat(dict_db->dict.fd, &st) < 0)
msg_fatal("dict_db_open: fstat: %m");
dict_db->dict.mtime = st.st_mtime;

View File

@@ -336,7 +336,7 @@ static NORETURN usage(char *myname)
msg_fatal("usage: %s type:file read|write|create", myname);
}
main(int argc, char **argv)
int main(int argc, char **argv)
{
VSTRING *keybuf = vstring_alloc(1);
DICT *dict;