summaryrefslogtreecommitdiff
path: root/usr/src/cmd/pack/pack.c
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/pack/pack.c
parentf1b64740276f67fc6914c1d855f2af601efe99ac (diff)
downloadillumos-joyent-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/pack/pack.c')
-rw-r--r--usr/src/cmd/pack/pack.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/usr/src/cmd/pack/pack.c b/usr/src/cmd/pack/pack.c
index fd67a70a3c..c8aad347b3 100644
--- a/usr/src/cmd/pack/pack.c
+++ b/usr/src/cmd/pack/pack.c
@@ -51,6 +51,8 @@
#include <string.h>
#include <dirent.h>
#include <unistd.h>
+#include <sys/acl.h>
+#include <aclutils.h>
#undef lint
@@ -350,7 +352,9 @@ main(int argc, char *argv[])
register char *cp;
int k, sep, errflg = 0;
int c;
+ int error;
int fcount = 0; /* count failures */
+ acl_t *aclp = NULL;
(void) setlocale(LC_ALL, "");
#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */
@@ -448,6 +452,7 @@ main(int argc, char *argv[])
"pack: %s: already exists\n"), filename);
goto closein;
}
+
if ((outfile = creat(filename, status.st_mode)) < 0) {
fprintf(stderr, gettext(
"pack: %s: cannot create: "), filename);
@@ -455,6 +460,13 @@ main(int argc, char *argv[])
goto closein;
}
+ error = facl_get(infile, ACL_NO_TRIVIAL, &aclp);
+
+ if (error != 0) {
+ fprintf(stderr, gettext(
+ "pack: %s: cannot retrieve ACL: %s\n"), argv[k],
+ acl_strerror(error));
+ }
if (packfile(argv[k]) &&
((pathconf(argv[k], _PC_XATTR_EXISTS) != 1) ||
(mv_xattrs(infile, outfile,
@@ -509,6 +521,12 @@ main(int argc, char *argv[])
perror("");
}
chown(filename, status.st_uid, status.st_gid);
+ if (aclp && (facl_set(outfile, aclp) < 0)) {
+ fprintf(stderr, gettext(
+ "pack: %s: failed to set acl entries\n"),
+ filename);
+ perror("");
+ }
if (!errflg)
fcount--; /* success after all */
} else {
@@ -517,6 +535,10 @@ main(int argc, char *argv[])
}
unlink(filename);
}
+
+ if (aclp)
+ acl_free(aclp);
+
closein: close(outfile);
close(infile);
}