-/* $OpenBSD: kern_sig.c,v 1.173 2014/07/13 16:41:21 claudio Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.174 2014/08/10 23:44:20 bluhm Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
p->p_rlimit[RLIMIT_CORE].rlim_cur)
return (EFBIG);
- if (nosuidcoredump == 3) {
+ if (incrash && nosuidcoredump == 3) {
/*
* If the program directory does not exist, dumps of
* that core will silently fail.
*/
len = snprintf(name, sizeof(name), "%s/%s/%u.core",
dir, p->p_comm, p->p_pid);
- } else if (nosuidcoredump == 2)
+ } else if (incrash && nosuidcoredump == 2)
len = snprintf(name, sizeof(name), "%s/%s.core",
dir, p->p_comm);
else