From e51a913788087f25c3d2d03842ca8fa94f1c550b Mon Sep 17 00:00:00 2001 From: pst Date: Fri, 23 Feb 1996 17:57:32 +0000 Subject: If a .db file is 0 length, initialize it as if it did not exist. Reviewed by: wollman --- lib/libc/db/hash/hash.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/libc') 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; -- cgit v1.1