aboutsummaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
Diffstat (limited to 'compat')
-rw-r--r--compat/Makefile.am2
-rw-r--r--compat/close.c2
-rw-r--r--compat/dbm-priv.h2
-rw-r--r--compat/dbm.h2
-rw-r--r--compat/dbmclose.c2
-rw-r--r--compat/dbmdelete.c4
-rw-r--r--compat/dbmdirfno.c2
-rw-r--r--compat/dbmerr.c2
-rw-r--r--compat/dbmfetch.c2
-rw-r--r--compat/dbminit.c4
-rw-r--r--compat/dbmopen.c32
-rw-r--r--compat/dbmpagfno.c2
-rw-r--r--compat/dbmrdonly.c2
-rw-r--r--compat/dbmseq.c2
-rw-r--r--compat/dbmstore.c2
-rw-r--r--compat/delete.c4
-rw-r--r--compat/fetch.c2
-rw-r--r--compat/ndbm.h2
-rw-r--r--compat/seq.c4
-rw-r--r--compat/store.c2
20 files changed, 47 insertions, 31 deletions
diff --git a/compat/Makefile.am b/compat/Makefile.am
index 3265c43..5fd6420 100644
--- a/compat/Makefile.am
+++ b/compat/Makefile.am
@@ -1,5 +1,5 @@
# This file is part of GDBM. -*- Makefile -*-
-# Copyright (C) 2007-2021 Free Software Foundation, Inc.
+# Copyright (C) 2007-2023 Free Software Foundation, Inc.
#
# GDBM is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/compat/close.c b/compat/close.c
index 9fb79ad..1e4a181 100644
--- a/compat/close.c
+++ b/compat/close.c
@@ -1,7 +1,7 @@
/* close.c - Close the "original" style database. */
/* This file is part of GDBM, the GNU data base manager.
- Copyright (C) 1993-2021 Free Software Foundation, Inc.
+ Copyright (C) 1993-2023 Free Software Foundation, Inc.
GDBM is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/compat/dbm-priv.h b/compat/dbm-priv.h
index 7d76a11..cbaa46d 100644
--- a/compat/dbm-priv.h
+++ b/compat/dbm-priv.h
@@ -1,5 +1,5 @@
/* This file is part of GDBM, the GNU data base manager.
- Copyright (C) 1990-2021 Free Software Foundation, Inc.
+ Copyright (C) 1990-2023 Free Software Foundation, Inc.
GDBM is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/compat/dbm.h b/compat/dbm.h
index 53b7fdb..208f368 100644
--- a/compat/dbm.h
+++ b/compat/dbm.h
@@ -1,7 +1,7 @@
/* dbm.h - The include file for dbm users. */
/* This file is part of GDBM, the GNU data base manager, by Philip A. Nelson.
- Copyright (C) 1990-2021 Free Software Foundation, Inc.
+ Copyright (C) 1990-2023 Free Software Foundation, Inc.
GDBM is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/compat/dbmclose.c b/compat/dbmclose.c
index 9212d3e..20c57a3 100644
--- a/compat/dbmclose.c
+++ b/compat/dbmclose.c
@@ -1,7 +1,7 @@
/* dbmclose.c - The the dbm file. This is the NDBM interface. */
/* This file is part of GDBM, the GNU data base manager.
- Copyright (C) 1990-2021 Free Software Foundation, Inc.
+ Copyright (C) 1990-2023 Free Software Foundation, Inc.
GDBM is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/compat/dbmdelete.c b/compat/dbmdelete.c
index 631d9f6..252920d 100644
--- a/compat/dbmdelete.c
+++ b/compat/dbmdelete.c
@@ -1,8 +1,8 @@
/* dbmdelete.c - Remove the key and its associated data from the database.
- This is the NDBM unix interface name. */
+ This is the NDBM UNIX interface name. */
/* This file is part of GDBM, the GNU data base manager.
- Copyright (C) 1990-2021 Free Software Foundation, Inc.
+ Copyright (C) 1990-2023 Free Software Foundation, Inc.
GDBM is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/compat/dbmdirfno.c b/compat/dbmdirfno.c
index f6c32c0..5b3c347 100644
--- a/compat/dbmdirfno.c
+++ b/compat/dbmdirfno.c
@@ -1,7 +1,7 @@
/* dbmdirfno.c - The .dir file number for NDBM interface. */
/* This file is part of GDBM, the GNU data base manager.
- Copyright (C) 1990-2021 Free Software Foundation, Inc.
+ Copyright (C) 1990-2023 Free Software Foundation, Inc.
GDBM is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/compat/dbmerr.c b/compat/dbmerr.c
index de0dd58..92f9eb5 100644
--- a/compat/dbmerr.c
+++ b/compat/dbmerr.c
@@ -1,5 +1,5 @@
/* This file is part of GDBM, the GNU data base manager.
- Copyright (C) 2011-2021 Free Software Foundation, Inc.
+ Copyright (C) 2011-2023 Free Software Foundation, Inc.
GDBM is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/compat/dbmfetch.c b/compat/dbmfetch.c
index ce645af..3a3b349 100644
--- a/compat/dbmfetch.c
+++ b/compat/dbmfetch.c
@@ -1,7 +1,7 @@
/* dbmfetch.c - Find a key and return the associated data. */
/* This file is part of GDBM, the GNU data base manager.
- Copyright (C) 1990-2021 Free Software Foundation, Inc.
+ Copyright (C) 1990-2023 Free Software Foundation, Inc.
GDBM is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/compat/dbminit.c b/compat/dbminit.c
index d8af045..66dae8a 100644
--- a/compat/dbminit.c
+++ b/compat/dbminit.c
@@ -2,7 +2,7 @@
DBM interface. */
/* This file is part of GDBM, the GNU data base manager.
- Copyright (C) 1990-2021 Free Software Foundation, Inc.
+ Copyright (C) 1990-2023 Free Software Foundation, Inc.
GDBM is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ DBM *_gdbm_file;
/* Initialize dbm system. FILE is a pointer to the file name. In
standard dbm, the database is found in files called FILE.pag and
- FILE.dir. To make gdbm compatable with dbm using the dbminit call,
+ FILE.dir. To make gdbm compatible with dbm using the dbminit call,
the same file names are used. Specifically, dbminit will use the file
name FILE.pag in its call to gdbm open. If the file (FILE.pag) has a
size of zero bytes, a file initialization procedure is performed,
diff --git a/compat/dbmopen.c b/compat/dbmopen.c
index 1c2e4b0..cb979b5 100644
--- a/compat/dbmopen.c
+++ b/compat/dbmopen.c
@@ -2,7 +2,7 @@
NDBM interface for dbm use. */
/* This file is part of GDBM, the GNU data base manager.
- Copyright (C) 1990-2021 Free Software Foundation, Inc.
+ Copyright (C) 1990-2023 Free Software Foundation, Inc.
GDBM is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -81,12 +81,21 @@ ndbm_open_dir_file0 (const char *file_name, int pagfd, int mode)
{
if (st.st_dev == pagst.st_dev && st.st_ino == pagst.st_ino)
{
- if (unlink (file_name))
+ if (flags == O_RDONLY)
{
- if ((mode & GDBM_OPENMASK) == GDBM_READER)
- /* Ok, try to cope with it. */
- return pagfd;
- else if (errno != ENOENT)
+ /*
+ * Don't touch the link if the database is opened read-only.
+ * Return a meaningful file descriptor for the sake
+ * of those programs that compare it with pagfd trying
+ * to detect old GDBM versions (as Sendmail does).
+ */
+ if ((fd = open ("/dev/null", flags)) == -1)
+ gdbm_set_errno (NULL, GDBM_FILE_OPEN_ERROR, TRUE);
+ return fd;
+ }
+ else if (unlink (file_name))
+ {
+ if (errno != ENOENT)
{
gdbm_set_errno (NULL, GDBM_FILE_OPEN_ERROR, TRUE);
return -1;
@@ -138,6 +147,13 @@ ndbm_open_dir_file0 (const char *file_name, int pagfd, int mode)
return -1;
}
}
+ else if (flags == O_RDONLY)
+ {
+ /* See the comment above. */
+ if ((fd = open ("/dev/null", flags)) == -1)
+ gdbm_set_errno (NULL, GDBM_FILE_OPEN_ERROR, TRUE);
+ return fd;
+ }
/* File does not exist. Create it. */
fd = open (file_name, flags | O_CREAT, pagst.st_mode & 0777);
@@ -178,7 +194,7 @@ ndbm_open_dir_file (const char *base, int pagfd, int mode)
/* Initialize ndbm system. FILE is a pointer to the file name. In
standard dbm, the database is found in files called FILE.pag and
- FILE.dir. To make gdbm compatable with dbm using the dbminit call,
+ FILE.dir. To make gdbm compatible with dbm using the dbminit call,
the same file names are used. Specifically, dbminit will use the file
name FILE.pag in its call to gdbm open. If the file (FILE.pag) has a
size of zero bytes, a file initialization procedure is performed,
@@ -194,7 +210,7 @@ ndbm_open_dir_file (const char *base, int pagfd, int mode)
FLAGS and MODE are the same as for the open(2) call. This call will
look at the FLAGS and decide what call to make to gdbm_open. For
FLAGS == O_RDONLY, it will be a GDBM_READER, if FLAGS == O_RDWR|O_CREAT,
- it will be a GDBM_WRCREAT (creater and writer) and if the FLAGS == O_RDWR,
+ it will be a GDBM_WRCREAT (creator and writer) and if the FLAGS == O_RDWR,
it will be a GDBM_WRITER and if FLAGS contain O_TRUNC then it will be
a GDBM_NEWDB. The O_CLOEXEC bit raises GDBM_CLOEXEC flag.
All other values of FLAGS are ignored. */
diff --git a/compat/dbmpagfno.c b/compat/dbmpagfno.c
index e2ad0a1..e4a4e1e 100644
--- a/compat/dbmpagfno.c
+++ b/compat/dbmpagfno.c
@@ -1,7 +1,7 @@
/* dbmpagfno.c - The .pag file number for NDBM interface. */
/* This file is part of GDBM, the GNU data base manager.
- Copyright (C) 1990-2021 Free Software Foundation, Inc.
+ Copyright (C) 1990-2023 Free Software Foundation, Inc.
GDBM is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/compat/dbmrdonly.c b/compat/dbmrdonly.c
index 9123303..73ae9e8 100644
--- a/compat/dbmrdonly.c
+++ b/compat/dbmrdonly.c
@@ -1,7 +1,7 @@
/* dbmrdonly.c - Check to see if a database is read only, NDBM style. */
/* This file is part of GDBM, the GNU data base manager.
- Copyright (C) 1993-2021 Free Software Foundation, Inc.
+ Copyright (C) 1993-2023 Free Software Foundation, Inc.
GDBM is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/compat/dbmseq.c b/compat/dbmseq.c
index 973eff1..b612396 100644
--- a/compat/dbmseq.c
+++ b/compat/dbmseq.c
@@ -2,7 +2,7 @@
interface. */
/* This file is part of GDBM, the GNU data base manager.
- Copyright (C) 1990-2021 Free Software Foundation, Inc.
+ Copyright (C) 1990-2023 Free Software Foundation, Inc.
GDBM is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/compat/dbmstore.c b/compat/dbmstore.c
index 5b2bde0..9fa0362 100644
--- a/compat/dbmstore.c
+++ b/compat/dbmstore.c
@@ -1,7 +1,7 @@
/* dbmstore.c - Add a new key/data pair to the database. */
/* This file is part of GDBM, the GNU data base manager.
- Copyright (C) 1990-2021 Free Software Foundation, Inc.
+ Copyright (C) 1990-2023 Free Software Foundation, Inc.
GDBM is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/compat/delete.c b/compat/delete.c
index 152c094..2dc67ed 100644
--- a/compat/delete.c
+++ b/compat/delete.c
@@ -1,8 +1,8 @@
/* delete.c - Remove the key and its associated data from the database.
- This is the original unix interface name. */
+ This is the original UNIX interface name. */
/* This file is part of GDBM, the GNU data base manager.
- Copyright (C) 1990-2021 Free Software Foundation, Inc.
+ Copyright (C) 1990-2023 Free Software Foundation, Inc.
GDBM is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/compat/fetch.c b/compat/fetch.c
index 4d2c300..8396913 100644
--- a/compat/fetch.c
+++ b/compat/fetch.c
@@ -1,7 +1,7 @@
/* fetch.c - Find a key and return the associated data. */
/* This file is part of GDBM, the GNU data base manager.
- Copyright (C) 1990-2021 Free Software Foundation, Inc.
+ Copyright (C) 1990-2023 Free Software Foundation, Inc.
GDBM is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/compat/ndbm.h b/compat/ndbm.h
index c5901df..71584a2 100644
--- a/compat/ndbm.h
+++ b/compat/ndbm.h
@@ -1,7 +1,7 @@
/* ndbm.h - The include file for ndbm users. */
/* This file is part of GDBM, the GNU data base manager, by Philip A. Nelson.
- Copyright (C) 1990-2021 Free Software Foundation, Inc.
+ Copyright (C) 1990-2023 Free Software Foundation, Inc.
GDBM is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/compat/seq.c b/compat/seq.c
index 534d662..39bfb51 100644
--- a/compat/seq.c
+++ b/compat/seq.c
@@ -1,8 +1,8 @@
/* seq.c - This is the sequential visit of the database. This defines two
- user-visable routines that are used together. This is the DBM interface. */
+ user-visible routines that are used together. This is the DBM interface. */
/* This file is part of GDBM, the GNU data base manager.
- Copyright (C) 1990-2021 Free Software Foundation, Inc.
+ Copyright (C) 1990-2023 Free Software Foundation, Inc.
GDBM is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/compat/store.c b/compat/store.c
index 69dac6f..5cb4e95 100644
--- a/compat/store.c
+++ b/compat/store.c
@@ -1,7 +1,7 @@
/* store.c - Add a new key/data pair to the database. */
/* This file is part of GDBM, the GNU data base manager.
- Copyright (C) 1990-2021 Free Software Foundation, Inc.
+ Copyright (C) 1990-2023 Free Software Foundation, Inc.
GDBM is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

Return to:

Send suggestions and report system problems to the System administrator.