Module Name:    src
Committed By:   christos
Date:           Wed Feb 20 19:42:14 UTC 2019

Modified Files:
        src/sys/kern: kern_descrip.c

Log Message:
handle O_NOSIGPIPE too.


To generate a diff of this commit:
cvs rdiff -u -r1.242 -r1.243 src/sys/kern/kern_descrip.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_descrip.c
diff -u src/sys/kern/kern_descrip.c:1.242 src/sys/kern/kern_descrip.c:1.243
--- src/sys/kern/kern_descrip.c:1.242	Thu Jan  3 05:16:43 2019
+++ src/sys/kern/kern_descrip.c	Wed Feb 20 14:42:14 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_descrip.c,v 1.242 2019/01/03 10:16:43 maxv Exp $	*/
+/*	$NetBSD: kern_descrip.c,v 1.243 2019/02/20 19:42:14 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.242 2019/01/03 10:16:43 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.243 2019/02/20 19:42:14 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -750,7 +750,7 @@ fd_dup2(file_t *fp, unsigned newfd, int 
 	fdfile_t *ff;
 	fdtab_t *dt;
 
-	if (flags & ~(O_CLOEXEC|O_NONBLOCK))
+	if (flags & ~(O_CLOEXEC|O_NONBLOCK|O_NOSIGPIPE))
 		return EINVAL;
 	/*
 	 * Ensure there are enough slots in the descriptor table,
@@ -791,7 +791,7 @@ fd_dup2(file_t *fp, unsigned newfd, int 
 	mutex_exit(&fdp->fd_lock);
 
 	dt->dt_ff[newfd]->ff_exclose = (flags & O_CLOEXEC) != 0;
-	fp->f_flag |= flags & FNONBLOCK;
+	fp->f_flag |= flags & (FNONBLOCK|FNOSIGPIPE);
 	/* Slot is now allocated.  Insert copy of the file. */
 	fd_affix(curproc, fp, newfd);
 	if (ff != NULL) {

Reply via email to