summaryrefslogtreecommitdiff
path: root/usr/src/cmd/unpack
diff options
context:
space:
mode:
authorahrens <none@none>2005-10-31 11:33:35 -0800
committerahrens <none@none>2005-10-31 11:33:35 -0800
commitfa9e4066f08beec538e775443c5be79dd423fcab (patch)
tree576d99665e57bb7cb70584431adb08c14d47e3ce /usr/src/cmd/unpack
parentf1b64740276f67fc6914c1d855f2af601efe99ac (diff)
downloadillumos-gate-fa9e4066f08beec538e775443c5be79dd423fcab.tar.gz
PSARC 2002/240 ZFS
6338653 Integrate ZFS PSARC 2004/652 - DKIOCFLUSH 5096886 Write caching disks need mechanism to flush cache to physical media
Diffstat (limited to 'usr/src/cmd/unpack')
-rw-r--r--usr/src/cmd/unpack/Makefile3
-rw-r--r--usr/src/cmd/unpack/unpack.c23
2 files changed, 24 insertions, 2 deletions
diff --git a/usr/src/cmd/unpack/Makefile b/usr/src/cmd/unpack/Makefile
index 87d0d01e11..076a2013e8 100644
--- a/usr/src/cmd/unpack/Makefile
+++ b/usr/src/cmd/unpack/Makefile
@@ -22,7 +22,7 @@
#
#ident "%Z%%M% %I% %E% SMI"
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
@@ -30,6 +30,7 @@ PROG= unpack
include ../Makefile.cmd
CFLAGS += $(CCVERBOSE)
+LDLIBS += -lsec
XGETFLAGS += -a -x unpack.xcl
.KEEP_STATE:
diff --git a/usr/src/cmd/unpack/unpack.c b/usr/src/cmd/unpack/unpack.c
index 0d2fe15cb7..766d129066 100644
--- a/usr/src/cmd/unpack/unpack.c
+++ b/usr/src/cmd/unpack/unpack.c
@@ -24,7 +24,7 @@
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -49,6 +49,8 @@
#include <limits.h>
#include <sys/param.h>
#include <dirent.h>
+#include <sys/acl.h>
+#include <aclutils.h>
static struct utimbuf u_times;
@@ -240,11 +242,13 @@ main(int argc, char *argv[])
{
extern int optind;
int i, k;
+ int error;
int sep, errflg = 0, pcat = 0;
register char *p1, *cp;
int fcount = 0; /* failure count */
int max_name;
void onsig(int);
+ acl_t *aclp;
if (signal(SIGHUP, SIG_IGN) != SIG_IGN)
@@ -334,6 +338,14 @@ main(int argc, char *argv[])
if (pcat)
outfile = 1; /* standard output */
else {
+
+ error = facl_get(infile, ACL_NO_TRIVIAL, &aclp);
+ if (error != 0) {
+ (void) printf(gettext(
+ "%s: %s: cannot retrieve ACL : %s\n"),
+ argv0, filename, acl_strerror(error));
+ }
+
max_name = pathconf(filename, _PC_NAME_MAX);
if (max_name == -1) {
/* no limit on length of filename */
@@ -395,6 +407,12 @@ main(int argc, char *argv[])
}
(void) chown(argvk,
status.st_uid, status.st_gid);
+ if (aclp && (facl_set(outfile, aclp) < 0)) {
+ (void) printf(gettext("%s: cannot "
+ "set ACL on %s: "), argv0, argvk);
+ perror("");
+ }
+
rmflg = 0;
(void) printf(gettext("%s: %s: unpacked\n"),
argv0, argvk);
@@ -415,6 +433,9 @@ main(int argc, char *argv[])
done: (void) close(infile);
if (!pcat)
(void) close(outfile);
+
+ if (aclp)
+ acl_free(aclp);
}
return (fcount);
}