Deleted Added
full compact
kern_descrip.c (274403) kern_descrip.c (274476)
1/*-
2 * Copyright (c) 1982, 1986, 1989, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 21 unchanged lines hidden (view full) ---

30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94
35 */
36
37#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1982, 1986, 1989, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 21 unchanged lines hidden (view full) ---

30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94
35 */
36
37#include <sys/cdefs.h>
38__FBSDID("$FreeBSD: head/sys/kern/kern_descrip.c 274403 2014-11-11 20:32:46Z glebius $");
38__FBSDID("$FreeBSD: head/sys/kern/kern_descrip.c 274476 2014-11-13 18:01:51Z kib $");
39
40#include "opt_capsicum.h"
41#include "opt_compat.h"
42#include "opt_ddb.h"
43#include "opt_ktrace.h"
44
45#include <sys/param.h>
46#include <sys/systm.h>

--- 2163 unchanged lines hidden (view full) ---

2210 for (i = 0; i <= 2; i++) {
2211 if (fdp->fd_ofiles[i].fde_file != NULL)
2212 continue;
2213
2214 save = td->td_retval[0];
2215 if (devnull != -1) {
2216 error = do_dup(td, DUP_FIXED, devnull, i);
2217 } else {
39
40#include "opt_capsicum.h"
41#include "opt_compat.h"
42#include "opt_ddb.h"
43#include "opt_ktrace.h"
44
45#include <sys/param.h>
46#include <sys/systm.h>

--- 2163 unchanged lines hidden (view full) ---

2210 for (i = 0; i <= 2; i++) {
2211 if (fdp->fd_ofiles[i].fde_file != NULL)
2212 continue;
2213
2214 save = td->td_retval[0];
2215 if (devnull != -1) {
2216 error = do_dup(td, DUP_FIXED, devnull, i);
2217 } else {
2218 error = kern_open(td, "/dev/null", UIO_SYSSPACE,
2219 O_RDWR, 0);
2218 error = kern_openat(td, AT_FDCWD, "/dev/null",
2219 UIO_SYSSPACE, O_RDWR, 0);
2220 if (error == 0) {
2221 devnull = td->td_retval[0];
2222 KASSERT(devnull == i, ("we didn't get our fd"));
2223 }
2224 }
2225 td->td_retval[0] = save;
2226 if (error != 0)
2227 return (error);

--- 1604 unchanged lines hidden ---
2220 if (error == 0) {
2221 devnull = td->td_retval[0];
2222 KASSERT(devnull == i, ("we didn't get our fd"));
2223 }
2224 }
2225 td->td_retval[0] = save;
2226 if (error != 0)
2227 return (error);

--- 1604 unchanged lines hidden ---