summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Eric Fagan <sef@FreeBSD.org>1999-10-30 18:55:11 +0000
committerSean Eric Fagan <sef@FreeBSD.org>1999-10-30 18:55:11 +0000
commit35a2598f8005d344b7c40123fb82920d1f50e5fd (patch)
tree6f647ee7f94117cfdf0ad40b6e03cd0e11dd0024
parent66a84ea76639c93f1fb97caa2a8f91d19759d742 (diff)
Notes
-rw-r--r--sys/kern/kern_sig.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 1cda7285ce80..6bdf48ed0a92 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;