Module Name: src
Committed By: christos
Date: Sun Jun 26 22:27:14 UTC 2011
Modified Files:
src/lib/libc/db/recno: rec_open.c
Log Message:
put back some compat code for systems that don't have O_CLOEXEC.
To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/lib/libc/db/recno/rec_open.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/db/recno/rec_open.c
diff -u src/lib/libc/db/recno/rec_open.c:1.18 src/lib/libc/db/recno/rec_open.c:1.19
--- src/lib/libc/db/recno/rec_open.c:1.18 Sun Jun 26 18:16:46 2011
+++ src/lib/libc/db/recno/rec_open.c Sun Jun 26 18:27:14 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: rec_open.c,v 1.18 2011/06/26 22:16:46 christos Exp $ */
+/* $NetBSD: rec_open.c,v 1.19 2011/06/26 22:27:14 christos Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -37,7 +37,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: rec_open.c,v 1.18 2011/06/26 22:16:46 christos Exp $");
+__RCSID("$NetBSD: rec_open.c,v 1.19 2011/06/26 22:27:14 christos Exp $");
#include "namespace.h"
#include <sys/types.h>
@@ -70,8 +70,15 @@
dbp = NULL;
/* Open the user's file -- if this fails, we're done. */
if (fname != NULL) {
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0
+#endif
if ((rfd = open(fname, flags | O_CLOEXEC, mode)) == -1)
return NULL;
+#if O_CLOEXEC == 0
+ if (fcntl(rfd, F_SETFD, FD_CLOEXEC) == -1)
+ goto err;
+#endif
}
/* Create a btree in memory (backed by disk). */