Deleted Added
full compact
kern_acct.c (3124) kern_acct.c (3308)
1/*-
2 * Copyright (c) 1994 Christopher G. Demetriou
3 * Copyright (c) 1982, 1986, 1989, 1993
4 * The Regents of the University of California. All rights reserved.
5 * (c) UNIX System Laboratories, Inc.
6 * All or some portions of this file are derived from material licensed
7 * to the University of California by American Telephone and Telegraph
8 * Co. or Unix System Laboratories, Inc. and are reproduced herein with

--- 23 unchanged lines hidden (view full) ---

32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
38 *
39 * @(#)kern_acct.c 8.1 (Berkeley) 6/14/93
1/*-
2 * Copyright (c) 1994 Christopher G. Demetriou
3 * Copyright (c) 1982, 1986, 1989, 1993
4 * The Regents of the University of California. All rights reserved.
5 * (c) UNIX System Laboratories, Inc.
6 * All or some portions of this file are derived from material licensed
7 * to the University of California by American Telephone and Telegraph
8 * Co. or Unix System Laboratories, Inc. and are reproduced herein with

--- 23 unchanged lines hidden (view full) ---

32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
38 *
39 * @(#)kern_acct.c 8.1 (Berkeley) 6/14/93
40 * $Id$
40 * $Id: kern_acct.c,v 1.5 1994/09/26 21:09:00 davidg Exp $
41 */
42
43#include <sys/param.h>
44#include <sys/systm.h>
45#include <sys/proc.h>
46#include <sys/mount.h>
47#include <sys/vnode.h>
48#include <sys/file.h>

--- 51 unchanged lines hidden (view full) ---

100 struct proc *p;
101 struct acct_args *uap;
102 int *retval;
103{
104 struct nameidata nd;
105 int error;
106
107 /* Make sure that the caller is root. */
41 */
42
43#include <sys/param.h>
44#include <sys/systm.h>
45#include <sys/proc.h>
46#include <sys/mount.h>
47#include <sys/vnode.h>
48#include <sys/file.h>

--- 51 unchanged lines hidden (view full) ---

100 struct proc *p;
101 struct acct_args *uap;
102 int *retval;
103{
104 struct nameidata nd;
105 int error;
106
107 /* Make sure that the caller is root. */
108 if (error = suser(p->p_ucred, &p->p_acflag))
108 error = suser(p->p_ucred, &p->p_acflag);
109 if (error)
109 return (error);
110
111 /*
112 * If accounting is to be started to a file, open that file for
113 * writing and make sure it's a 'normal'.
114 */
115 if (uap->path != NULL) {
116 NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, p);
110 return (error);
111
112 /*
113 * If accounting is to be started to a file, open that file for
114 * writing and make sure it's a 'normal'.
115 */
116 if (uap->path != NULL) {
117 NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, p);
117 if (error = vn_open(&nd, FWRITE, 0))
118 error = vn_open(&nd, FWRITE, 0);
119 if (error)
118 return (error);
119 VOP_UNLOCK(nd.ni_vp);
120 if (nd.ni_vp->v_type != VREG) {
121 vn_close(nd.ni_vp, FWRITE, p->p_ucred, p);
122 return (EACCES);
123 }
124 }
125

--- 179 unchanged lines hidden ---
120 return (error);
121 VOP_UNLOCK(nd.ni_vp);
122 if (nd.ni_vp->v_type != VREG) {
123 vn_close(nd.ni_vp, FWRITE, p->p_ucred, p);
124 return (EACCES);
125 }
126 }
127

--- 179 unchanged lines hidden ---