From f0113fc0f7724eed33131d7bc1f72de8e704c7d4 Mon Sep 17 00:00:00 2001 From: Paul Traina Date: Fri, 23 Feb 1996 17:57:32 +0000 Subject: [PATCH] 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(-) diff --git a/lib/libc/db/hash/hash.c b/lib/libc/db/hash/hash.c index 76da99c055a..ea6ff4731ed 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;