Whamcloud - gitweb
LU-5817 clio: Do not allow group locks with gid 0
[fs/lustre-release.git] / lustre / utils / lfs.c
index e1e5a62..47860f7 100644 (file)
@@ -368,6 +368,7 @@ static int random_group_id(int *gid)
                goto out;
        }
 
+retry:
        rc = read(fd, gid, sz);
        if (rc < sz) {
                rc = -errno;
@@ -376,6 +377,10 @@ static int random_group_id(int *gid)
                goto out;
        }
 
+       /* gids must be non-zero */
+       if (*gid == 0)
+               goto retry;
+
 out:
        if (fd >= 0)
                close(fd);
@@ -3364,7 +3369,7 @@ static int lfs_changelog(int argc, char **argv)
                                printf(" s="DFID" sp="DFID" %.*s",
                                       PFID(&rnm->cr_sfid),
                                       PFID(&rnm->cr_spfid),
-                                      changelog_rec_snamelen(rec),
+                                      (int)changelog_rec_snamelen(rec),
                                       changelog_rec_sname(rec));
                }
                printf("\n");