kern_sharedpage.c (88633) | kern_sharedpage.c (89306) |
---|---|
1/* 2 * Copyright (c) 1993, David Greenman 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/* 2 * Copyright (c) 1993, David Greenman 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/kern/kern_exec.c 88633 2001-12-29 07:13:47Z alfred $ | 26 * $FreeBSD: head/sys/kern/kern_exec.c 89306 2002-01-13 11:58:06Z alfred $ |
27 */ 28 29#include <sys/param.h> 30#include <sys/systm.h> 31#include <sys/lock.h> 32#include <sys/mutex.h> 33#include <sys/sysproto.h> 34#include <sys/signalvar.h> --- 241 unchanged lines hidden (view full) --- 276 (*p->p_sysent->sv_fixup)(&stack_base, imgp); 277 else 278 suword(--stack_base, imgp->argc); 279 280 /* 281 * For security and other reasons, the file descriptor table cannot 282 * be shared after an exec. 283 */ | 27 */ 28 29#include <sys/param.h> 30#include <sys/systm.h> 31#include <sys/lock.h> 32#include <sys/mutex.h> 33#include <sys/sysproto.h> 34#include <sys/signalvar.h> --- 241 unchanged lines hidden (view full) --- 276 (*p->p_sysent->sv_fixup)(&stack_base, imgp); 277 else 278 suword(--stack_base, imgp->argc); 279 280 /* 281 * For security and other reasons, the file descriptor table cannot 282 * be shared after an exec. 283 */ |
284 FILEDESC_LOCK(p->p_fd); |
|
284 if (p->p_fd->fd_refcnt > 1) { 285 struct filedesc *tmp; 286 287 tmp = fdcopy(td); | 285 if (p->p_fd->fd_refcnt > 1) { 286 struct filedesc *tmp; 287 288 tmp = fdcopy(td); |
289 FILEDESC_UNLOCK(p->p_fd); |
|
288 fdfree(td); 289 p->p_fd = tmp; | 290 fdfree(td); 291 p->p_fd = tmp; |
290 } | 292 } else 293 FILEDESC_UNLOCK(p->p_fd); |
291 292 /* 293 * For security and other reasons, signal handlers cannot 294 * be shared after an exec. The new process gets a copy of the old 295 * handlers. In execsigs(), the new process will have its signals 296 * reset. 297 */ 298 if (p->p_procsig->ps_refcnt > 1) { --- 688 unchanged lines hidden --- | 294 295 /* 296 * For security and other reasons, signal handlers cannot 297 * be shared after an exec. The new process gets a copy of the old 298 * handlers. In execsigs(), the new process will have its signals 299 * reset. 300 */ 301 if (p->p_procsig->ps_refcnt > 1) { --- 688 unchanged lines hidden --- |