diff options
author | pst <pst@FreeBSD.org> | 1996-02-23 17:57:32 +0000 |
---|---|---|
committer | pst <pst@FreeBSD.org> | 1996-02-23 17:57:32 +0000 |
commit | e51a913788087f25c3d2d03842ca8fa94f1c550b (patch) | |
tree | 9d96910d9cbde37b0c510a1280190f408251d71b /lib | |
parent | fe4185f0276539508fb2aac6cf2396609f0114b3 (diff) | |
download | FreeBSD-src-e51a913788087f25c3d2d03842ca8fa94f1c550b.zip FreeBSD-src-e51a913788087f25c3d2d03842ca8fa94f1c550b.tar.gz |
If a .db file is 0 length, initialize it as if it did not exist.
Reviewed by: wollman
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/db/hash/hash.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libc/db/hash/hash.c b/lib/libc/db/hash/hash.c index 76da99c..ea6ff47 100644 --- a/lib/libc/db/hash/hash.c +++ b/lib/libc/db/hash/hash.c @@ -122,7 +122,8 @@ __hash_open(file, flags, mode, info, dflags) new_table = 0; if (!file || (flags & O_TRUNC) || - (stat(file, &statbuf) && (errno == ENOENT))) { + (stat(file, &statbuf) && (errno == ENOENT)) || + statbuf.st_size == 0) { if (errno == ENOENT) errno = 0; /* Just in case someone looks at errno */ new_table = 1; |