diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-11-10 22:27:18 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-11-10 22:27:18 +0000 |
commit | 902a2e4bb5aa53241898ae34dcf7aafb29df7b7e (patch) | |
tree | 8ccc38229f02ecf7ae264712e829ba5ae64e5912 /compat | |
parent | 3556dd6310425a2c175e66a9ba6f7d5f61304302 (diff) | |
download | gdbm-902a2e4bb5aa53241898ae34dcf7aafb29df7b7e.tar.gz gdbm-902a2e4bb5aa53241898ae34dcf7aafb29df7b7e.tar.bz2 |
Fix handling of NDBM databases in read-only mode.
* compat/dbmopen.c (ndbm_open_dir_file0): Open dir file in
read-only mode if the database is being opened as GDBM_READER.
* tests/dbmcvt.at: New file.
* tests/dbmfetch02.at: New file.
* tests/dbmfetch03.at: New file.
* tests/Makefile.am (TESTSUITE_AT): Add new files.
* tests/testsuite.at: Include new testcases.
Diffstat (limited to 'compat')
-rw-r--r-- | compat/dbmopen.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compat/dbmopen.c b/compat/dbmopen.c index 9e66acc..0125903 100644 --- a/compat/dbmopen.c +++ b/compat/dbmopen.c @@ -104,7 +104,7 @@ ndbm_open_dir_file0 (const char *file_name, int pagfd, int mode) } else { - fd = open (file_name, O_RDWR); + fd = open (file_name, mode == GDBM_READER ? O_RDONLY : O_RDWR); if (fd == -1) { gdbm_errno = GDBM_FILE_OPEN_ERROR; |