Message ID | 1528831883-21879-6-git-send-email-sandeen@sandeen.net (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, Jun 12, 2018 at 02:31:21PM -0500, Eric Sandeen wrote: > After open of the configfile, simply fstat() that fd to ensure that > we are checking the file we just opened, not something that got > renamed in between. > > Signed-off-by: Eric Sandeen <sandeen@redhat.com> > Signed-off-by: Eric Sandeen <sandeen@sandeen.net> Looks ok, Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> --D > --- > mkfs/config.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/mkfs/config.c b/mkfs/config.c > index f27e480..940a055 100644 > --- a/mkfs/config.c > +++ b/mkfs/config.c > @@ -550,7 +550,7 @@ open_cli_config( > if (fd < 0) > goto out; > > - ret = fstatat(dirfd, cli_config_file, &st, AT_SYMLINK_NOFOLLOW); > + ret = fstat(fd, &st); > if (ret != 0) > goto err_out_close; > > @@ -563,7 +563,7 @@ open_cli_config( > > memcpy(*fpath, cli_config_file, strlen(cli_config_file)); > > - ret = fstatat(AT_FDCWD, cli_config_file, &st, AT_SYMLINK_NOFOLLOW); > + ret = fstat(fd, &st); > if (ret != 0) > goto err_out_close; > > @@ -593,7 +593,7 @@ int > open_config_file( > const char *cli_config_file, > struct mkfs_default_params *dft, > - char **fpath) > + char **fpath) /* path where config is found */ > { > int dirfd, fd = -1, len, ret; > struct stat st; > @@ -628,7 +628,7 @@ open_config_file( > goto err_out_close; > } > > - ret = fstatat(dirfd, "default", &st, AT_SYMLINK_NOFOLLOW); > + ret = fstat(fd, &st); > if (ret != 0) > goto err_out_close; > > -- > 1.8.3.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-xfs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/mkfs/config.c b/mkfs/config.c index f27e480..940a055 100644 --- a/mkfs/config.c +++ b/mkfs/config.c @@ -550,7 +550,7 @@ open_cli_config( if (fd < 0) goto out; - ret = fstatat(dirfd, cli_config_file, &st, AT_SYMLINK_NOFOLLOW); + ret = fstat(fd, &st); if (ret != 0) goto err_out_close; @@ -563,7 +563,7 @@ open_cli_config( memcpy(*fpath, cli_config_file, strlen(cli_config_file)); - ret = fstatat(AT_FDCWD, cli_config_file, &st, AT_SYMLINK_NOFOLLOW); + ret = fstat(fd, &st); if (ret != 0) goto err_out_close; @@ -593,7 +593,7 @@ int open_config_file( const char *cli_config_file, struct mkfs_default_params *dft, - char **fpath) + char **fpath) /* path where config is found */ { int dirfd, fd = -1, len, ret; struct stat st; @@ -628,7 +628,7 @@ open_config_file( goto err_out_close; } - ret = fstatat(dirfd, "default", &st, AT_SYMLINK_NOFOLLOW); + ret = fstat(fd, &st); if (ret != 0) goto err_out_close;