diff options
author | sef <sef@FreeBSD.org> | 1999-10-30 18:55:11 +0000 |
---|---|---|
committer | sef <sef@FreeBSD.org> | 1999-10-30 18:55:11 +0000 |
commit | b13167ae88c2d5c837196ff703c52731a8cd72c8 (patch) | |
tree | 6f647ee7f94117cfdf0ad40b6e03cd0e11dd0024 /sys/kern/kern_sig.c | |
parent | 769c5f26dfd6a4c21bbcab3904a783bc04083bfb (diff) | |
download | FreeBSD-src-b13167ae88c2d5c837196ff703c52731a8cd72c8.zip FreeBSD-src-b13167ae88c2d5c837196ff703c52731a8cd72c8.tar.gz |
Bail out of the process early if the coredumpfile limit is 0.
PR: kern/14540
Reviewed by: Nate Williams
Diffstat (limited to 'sys/kern/kern_sig.c')
-rw-r--r-- | sys/kern/kern_sig.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 1cda728..6bdf48e 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1595,11 +1595,17 @@ coredump(p) return (EFAULT); /* - * Note that this layout means that limit checking is done - * AFTER the corefile name is created. This could happen - * other ways as well, so I'm not too worried about it, but - * it is potentially confusing. + * Note that the bulk of limit checking is done after + * the corefile is created. The exception is if the limit + * for corefiles is 0, in which case we don't bother + * creating the corefile at all. This layout means that + * a corefile is truncated instead of not being created, + * if it is larger than the limit. */ + limit = p->p_rlimit[RLIMIT_CORE].rlim_cur; + if (limit == 0) + return 0; + name = expand_name(p->p_comm, p->p_ucred->cr_uid, p->p_pid); NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, name, p); error = vn_open(&nd, O_CREAT | FWRITE | O_NOFOLLOW, S_IRUSR | S_IWUSR); @@ -1620,8 +1626,6 @@ coredump(p) VOP_SETATTR(vp, &vattr, cred, p); p->p_acflag |= ACORE; - limit = p->p_rlimit[RLIMIT_CORE].rlim_cur; - error = p->p_sysent->sv_coredump ? p->p_sysent->sv_coredump(p, vp, limit) : ENOSYS; |