Preserve acls option on mounts when taking a snapshot.

Submitted by:	Wiktor Niesiobedzki <freebsd-lists@w.evip.pl>
This commit is contained in:
Kirk McKusick 2004-01-27 18:28:11 +00:00
parent c5f3bff0be
commit cea1849767

View File

@ -56,6 +56,7 @@ int
main(int argc, char **argv) main(int argc, char **argv)
{ {
char *dir, *cp, path[PATH_MAX]; char *dir, *cp, path[PATH_MAX];
struct statfs stfsbuf;
struct ufs_args args; struct ufs_args args;
struct group *grp; struct group *grp;
struct stat stbuf; struct stat stbuf;
@ -85,6 +86,8 @@ main(int argc, char **argv)
} else { } else {
strlcpy(path, args.fspec, cp - args.fspec + 1); strlcpy(path, args.fspec, cp - args.fspec + 1);
} }
if(statfs(path, &stfsbuf) < 0)
err(1, "%s", path);
if (stat(path, &stbuf) < 0) if (stat(path, &stbuf) < 0)
err(1, "%s", path); err(1, "%s", path);
if (!S_ISDIR(stbuf.st_mode)) if (!S_ISDIR(stbuf.st_mode))
@ -100,7 +103,8 @@ main(int argc, char **argv)
*/ */
if ((grp = getgrnam("operator")) == NULL) if ((grp = getgrnam("operator")) == NULL)
errx(1, "Cannot retrieve operator gid"); errx(1, "Cannot retrieve operator gid");
if (mount("ffs", dir, MNT_UPDATE | MNT_SNAPSHOT, &args) < 0) if (mount("ffs", dir, MNT_UPDATE | MNT_SNAPSHOT | stfsbuf.f_flags,
&args) < 0)
err(1, "Cannot create %s", args.fspec); err(1, "Cannot create %s", args.fspec);
if ((fd = open(args.fspec, O_RDONLY)) < 0) if ((fd = open(args.fspec, O_RDONLY)) < 0)
err(1, "Cannot open %s", args.fspec); err(1, "Cannot open %s", args.fspec);