Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/vi/common Set FD_CLOEXEC on the recovery mail file.



details:   https://anonhg.NetBSD.org/src/rev/978a09b3bc82
branches:  trunk
changeset: 573073:978a09b3bc82
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Wed Jan 19 01:20:24 2005 +0000

description:
Set FD_CLOEXEC on the recovery mail file.

diffstat:

 usr.bin/vi/common/recover.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (30 lines):

diff -r ecb91de70f57 -r 978a09b3bc82 usr.bin/vi/common/recover.c
--- a/usr.bin/vi/common/recover.c       Wed Jan 19 01:18:59 2005 +0000
+++ b/usr.bin/vi/common/recover.c       Wed Jan 19 01:20:24 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: recover.c,v 1.8 2002/04/09 01:47:32 thorpej Exp $      */
+/*     $NetBSD: recover.c,v 1.9 2005/01/19 01:20:24 mycroft Exp $      */
 
 /*-
  * Copyright (c) 1993, 1994
@@ -16,7 +16,7 @@
 #if 0
 static const char sccsid[] = "@(#)recover.c    10.21 (Berkeley) 9/15/96";
 #else
-__RCSID("$NetBSD: recover.c,v 1.8 2002/04/09 01:47:32 thorpej Exp $");
+__RCSID("$NetBSD: recover.c,v 1.9 2005/01/19 01:20:24 mycroft Exp $");
 #endif
 #endif /* not lint */
 
@@ -370,8 +370,9 @@
                return (1);
        dp = O_STR(sp, O_RECDIR);
        (void)snprintf(mpath, sizeof(mpath), "%s/recover.XXXXXX", dp);
-       if ((fd = rcv_mktemp(sp, mpath, dp, S_IRUSR | S_IWUSR)) == -1)
-               return (1);
+       if ((fd = rcv_mktemp(sp, mpath, dp, S_IRUSR | S_IWUSR)) == -1 ||
+           fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
+               goto err;
 
        /*
         * XXX



Home | Main Index | Thread Index | Old Index