diff options
Diffstat (limited to 'usr/src/uts/common/syscall/mkdir.c')
-rw-r--r-- | usr/src/uts/common/syscall/mkdir.c | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/usr/src/uts/common/syscall/mkdir.c b/usr/src/uts/common/syscall/mkdir.c index ef50e5a99d..ce21aaffc2 100644 --- a/usr/src/uts/common/syscall/mkdir.c +++ b/usr/src/uts/common/syscall/mkdir.c @@ -20,11 +20,9 @@ */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved. */ - /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ @@ -33,8 +31,6 @@ * under license from the Regents of the University of California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/param.h> #include <sys/isa_defs.h> #include <sys/types.h> @@ -43,15 +39,19 @@ #include <sys/user.h> #include <sys/errno.h> #include <sys/vnode.h> +#include <sys/file.h> +#include <sys/fcntl.h> #include <sys/uio.h> #include <sys/debug.h> +#include <c2/audit.h> /* * Make a directory. */ int -mkdir(char *dname, int dmode) +mkdirat(int fd, char *dname, int dmode) { + vnode_t *startvp; vnode_t *vp; struct vattr vattr; int error; @@ -59,10 +59,26 @@ mkdir(char *dname, int dmode) vattr.va_type = VDIR; vattr.va_mode = dmode & PERMMASK; vattr.va_mask = AT_TYPE|AT_MODE; - error = vn_create(dname, UIO_USERSPACE, &vattr, EXCL, 0, &vp, CRMKDIR, - 0, PTOU(curproc)->u_cmask); + + if (dname == NULL) + return (set_errno(EFAULT)); + if ((error = fgetstartvp(fd, dname, &startvp)) != 0) + return (set_errno(error)); + if (AU_AUDITING() && startvp != NULL) + audit_setfsat_path(1); + + error = vn_createat(dname, UIO_USERSPACE, &vattr, EXCL, 0, &vp, + CRMKDIR, 0, PTOU(curproc)->u_cmask, startvp); + if (startvp != NULL) + VN_RELE(startvp); if (error) return (set_errno(error)); VN_RELE(vp); return (0); } + +int +mkdir(char *dname, int dmode) +{ + return (mkdirat(AT_FDCWD, dname, dmode)); +} |