mksnap slashes acls option?

Wiktor Niesiobedzki freebsd-lists at w.evip.pl
Tue Jan 27 06:55:00 PST 2004


On Tue, Jan 20, 2004 at 10:13:51AM +0900, Kimura Fuyuki wrote:
> Something dangerous seems to happen...
> 
> # mdmfs -s 1m -o acls md1 /mnt
> # mount
> <snip>
> /dev/md1 on /mnt (ufs, local, soft-updates, acls)
> # mksnap_ffs /mnt /mnt/.snap/snap
> # mount
> <snip>
> /dev/md1 on /mnt (ufs, local, soft-updates)
>                                           !!!!
> Ooh, where is the acls option??
> 
Some small patch to mksnap_ffs to correct this bug.

Can someone review this and commit?


Cheers,

Wiktor Niesiobedzki
-------------- next part --------------
--- sbin/mksnap_ffs/mksnap_ffs.c	2003/11/04 07:04:01	1.5
+++ sbin/mksnap_ffs/mksnap_ffs.c	2004/01/27 14:23:46
@@ -59,6 +59,7 @@
 	struct ufs_args args;
 	struct group *grp;
 	struct stat stbuf;
+	struct statfs stfsbuf;
 	int fd;
 
 	if (argc != 3)
@@ -94,13 +95,15 @@
 	if ((stbuf.st_mode & S_ISTXT) && stbuf.st_uid != getuid())
 		errx(1, "Lack write permission in %s: Sticky bit set", path);
 
+	if(statfs(path, &stfsbuf) < 0)
+		err(1, "%s", path);
 	/*
 	 * Having verified access to the directory in which the
 	 * snapshot is to be built, proceed with creating it.
 	 */
 	if ((grp = getgrnam("operator")) == NULL)
 		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);
 	if ((fd = open(args.fspec, O_RDONLY)) < 0)
 		err(1, "Cannot open %s", args.fspec);


More information about the freebsd-current mailing list