26c26
< * $FreeBSD: head/sys/kern/imgact_aout.c 50477 1999-08-28 01:08:13Z peter $
---
> * $FreeBSD: head/sys/kern/imgact_aout.c 50717 1999-09-01 00:29:56Z julian $
78c78
< static int
---
> int
247c247
< aout_coredump(p)
---
> aout_coredump(p, vp, limit)
249d248
< {
250a250,251
> off_t limit;
> {
253,256c254
< struct nameidata nd;
< struct vattr vattr;
< int error, error1;
< char *name; /* name of corefile */
---
> int error = 0;
258,260d255
< STOPEVENT(p, S_CORE, 0);
< if (sugid_coredump == 0 && p->p_flag & P_SUGID)
< return (EFAULT);
262c257
< p->p_rlimit[RLIMIT_CORE].rlim_cur)
---
> limit)
264,272d258
< name = expand_name(p->p_comm, p->p_ucred->cr_uid, p->p_pid);
< if (name == NULL)
< return (EFAULT); /* XXX -- not the best error */
< NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, name, p);
< error = vn_open(&nd, O_CREAT | FWRITE | O_NOFOLLOW, S_IRUSR | S_IWUSR);
< free(name, M_TEMP);
< if (error)
< return (error);
< vp = nd.ni_vp;
274,284d259
< /* Don't dump to non-regular files or files with links. */
< if (vp->v_type != VREG ||
< VOP_GETATTR(vp, &vattr, cred, p) || vattr.va_nlink != 1) {
< error = EFAULT;
< goto out;
< }
< VATTR_NULL(&vattr);
< vattr.va_size = 0;
< VOP_LEASE(vp, p, cred, LEASE_WRITE);
< VOP_SETATTR(vp, &vattr, cred, p);
< p->p_acflag |= ACORE;
298,303c273
< out:
< VOP_UNLOCK(vp, 0, p);
< error1 = vn_close(vp, FWRITE, cred, p);
< if (error == 0)
< error = error1;
< return (error);
---
> return error;
< * $FreeBSD: head/sys/kern/imgact_aout.c 50477 1999-08-28 01:08:13Z peter $
---
> * $FreeBSD: head/sys/kern/imgact_aout.c 50717 1999-09-01 00:29:56Z julian $
78c78
< static int
---
> int
247c247
< aout_coredump(p)
---
> aout_coredump(p, vp, limit)
249d248
< {
250a250,251
> off_t limit;
> {
253,256c254
< struct nameidata nd;
< struct vattr vattr;
< int error, error1;
< char *name; /* name of corefile */
---
> int error = 0;
258,260d255
< STOPEVENT(p, S_CORE, 0);
< if (sugid_coredump == 0 && p->p_flag & P_SUGID)
< return (EFAULT);
262c257
< p->p_rlimit[RLIMIT_CORE].rlim_cur)
---
> limit)
264,272d258
< name = expand_name(p->p_comm, p->p_ucred->cr_uid, p->p_pid);
< if (name == NULL)
< return (EFAULT); /* XXX -- not the best error */
< NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, name, p);
< error = vn_open(&nd, O_CREAT | FWRITE | O_NOFOLLOW, S_IRUSR | S_IWUSR);
< free(name, M_TEMP);
< if (error)
< return (error);
< vp = nd.ni_vp;
274,284d259
< /* Don't dump to non-regular files or files with links. */
< if (vp->v_type != VREG ||
< VOP_GETATTR(vp, &vattr, cred, p) || vattr.va_nlink != 1) {
< error = EFAULT;
< goto out;
< }
< VATTR_NULL(&vattr);
< vattr.va_size = 0;
< VOP_LEASE(vp, p, cred, LEASE_WRITE);
< VOP_SETATTR(vp, &vattr, cred, p);
< p->p_acflag |= ACORE;
298,303c273
< out:
< VOP_UNLOCK(vp, 0, p);
< error1 = vn_close(vp, FWRITE, cred, p);
< if (error == 0)
< error = error1;
< return (error);
---
> return error;