tags 293411 patch
thanks

Patch for bug #293411 in ufsutils.  It's not perfect as it hardcodes the
operator gid, though.

I'm setting 5 for FreeBSD (verified) and 37 as the fallback case.  Maybe you
want to use -DDEBIAN and set 37 for Debian and something else as fallback.

I think this number is only used to set perms in /.snap, anyway, so it's not
that much important.

-- 
 .''`.   Proudly running Debian GNU/kFreeBSD unstable/unreleased (on UFS2+S)
: :' :
`. `'    http://www.debian.org/ports/kfreebsd-gnu
  `-
diff -ur ufsutils-0.0+2004.06.26.old/mkfs.ufs/mkfs.c 
ufsutils-0.0+2004.06.26/mkfs.ufs/mkfs.c
--- ufsutils-0.0+2004.06.26.old/mkfs.ufs/mkfs.c 2004-04-09 21:58:33.000000000 
+0200
+++ ufsutils-0.0+2004.06.26/mkfs.ufs/mkfs.c     2005-02-03 06:06:41.000000000 
+0100
@@ -733,10 +733,18 @@
 {
        union dinode node;
        struct group *grp;
+#if defined(__FreeBSD__)
+#define OPERATOR_GID 5
+#else
+#define OPERATOR_GID 37
+#endif
+       gid_t operator_gid = OPERATOR_GID;
 
        memset(&node, 0, sizeof node);
        if ((grp = getgrnam("operator")) == NULL)
-               errx(35, "Cannot retrieve operator gid");
+               fprintf (stderr, "warning: Cannot retrieve operator gid, 
assuming %d\n", OPERATOR_GID);
+       else
+               operator_gid = grp->gr_gid;
        if (sblock.fs_magic == FS_UFS1_MAGIC) {
                /*
                 * initialize the node
@@ -760,7 +768,7 @@
                 * create the .snap directory
                 */
                node.dp1.di_mode |= 020;
-               node.dp1.di_gid = grp->gr_gid;
+               node.dp1.di_gid = operator_gid;
                node.dp1.di_nlink = SNAPLINKCNT;
                node.dp1.di_size = makedir(snap_dir, SNAPLINKCNT);
                node.dp1.di_db[0] = alloc(sblock.fs_fsize, node.dp1.di_mode);

Reply via email to