From 231938b60118a0965050240959d7cbb3d9fc67f4 Mon Sep 17 00:00:00 2001 From: Keith Bostic Date: Wed, 20 Feb 1991 16:59:45 -0800 Subject: [PATCH] don't do the fcntl unless the file was openeed SCCS-vsn: lib/libc/db/hash/hash.c 5.4 --- usr/src/lib/libc/db/hash/hash.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/usr/src/lib/libc/db/hash/hash.c b/usr/src/lib/libc/db/hash/hash.c index 5d9215cf8b..9647f512d5 100644 --- a/usr/src/lib/libc/db/hash/hash.c +++ b/usr/src/lib/libc/db/hash/hash.c @@ -9,7 +9,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)hash.c 5.3 (Berkeley) %G%"; +static char sccsid[] = "@(#)hash.c 5.4 (Berkeley) %G%"; #endif /* LIBC_SCCS and not lint */ #include @@ -133,10 +133,12 @@ HASHINFO *info; /* Special directives for create */ new_table = 1; } - if ( file && ((hashp->fp = open ( file, flags, mode )) == -1)) { - RETURN_ERROR (errno, error0); + if ( file ) { + if ((hashp->fp = open ( file, flags, mode )) == -1) { + RETURN_ERROR (errno, error0); + } + (void)fcntl(hashp->fp, F_SETFD, 1); } - (void)fcntl(hashp->fp, F_SETFD, 1); if ( new_table ) { if ( !(hashp = init_hash( info )) ) { -- 2.20.1