Commit | Line | Data |
---|---|---|
2baf4634 MB |
1 | This patch originates from the Debian project, see https://www.debian.org/ |
2 | ||
3 | 03db4.dpatch by <hesso@pool.math.tu-berlin.de> | |
4 | ||
5 | ||
6 | libdb4 compatibility adjustments. | |
7 | ||
8 | In particular, this patch adds extra file permission checking and passes the | |
9 | DB_CREATE flag to the first invocation of db_open on the file's database | |
10 | structure, which rids us of the following message: | |
11 | ||
12 | BDB0635 DB_CREATE must be specified to create databases. | |
13 | ||
14 | --- nvi-1.81.6.orig/common/msg.c 2009-02-26 14:26:58.350336128 +0100 | |
15 | +++ nvi-1.81.6/common/msg.c 2009-02-26 14:29:05.235335829 +0100 | |
16 | @@ -724,9 +724,18 @@ | |
17 | p = buf; | |
18 | } else | |
19 | p = file; | |
20 | + if (access(p, F_OK) != 0) { | |
21 | + if (first) { | |
22 | + first = 0; | |
23 | + return (1); | |
24 | + } | |
25 | + sp->db_error = ENOENT; | |
26 | + msgq_str(sp, M_DBERR, p, "%s"); | |
27 | + return (1); | |
28 | + } | |
29 | if ((sp->db_error = db_create(&db, 0, 0)) != 0 || | |
30 | (sp->db_error = db->set_re_source(db, p)) != 0 || | |
31 | - (sp->db_error = db_open(db, NULL, DB_RECNO, 0, 0)) != 0) { | |
32 | + (sp->db_error = db_open(db, NULL, DB_RECNO, DB_CREATE, 0)) != 0) { | |
33 | if (first) { | |
34 | first = 0; | |
35 | return (1); |