Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/db/recno put back some compat code for systems that...



details:   https://anonhg.NetBSD.org/src/rev/90958ab44943
branches:  trunk
changeset: 766545:90958ab44943
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Jun 26 22:27:14 2011 +0000

description:
put back some compat code for systems that don't have O_CLOEXEC.

diffstat:

 lib/libc/db/recno/rec_open.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r 30f96d909c3c -r 90958ab44943 lib/libc/db/recno/rec_open.c
--- a/lib/libc/db/recno/rec_open.c      Sun Jun 26 22:20:31 2011 +0000
+++ b/lib/libc/db/recno/rec_open.c      Sun Jun 26 22:27:14 2011 +0000
@@ -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). */



Home | Main Index | Thread Index | Old Index