[03/12] fsx: shut up compiler warnings
diff mbox series

Message ID 154290952722.1218.5031880474187869562.stgit@magnolia
State New
Headers show
Series
  • xfstests: add copy/dedupe/clone to fsx/fsstress
Related show

Commit Message

Darrick J. Wong Nov. 22, 2018, 5:58 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

Fix unused variables and potential filename overflows in fsx.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 ltp/fsx.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Allison Henderson Nov. 24, 2018, 6:23 p.m. UTC | #1
Looks good:

Reviewed-By: Allison Henderson <allison.henderson@oracle.com>

Allison

On 11/22/18 10:58 AM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Fix unused variables and potential filename overflows in fsx.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>   ltp/fsx.c |   10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 
> 
> diff --git a/ltp/fsx.c b/ltp/fsx.c
> index b0157ba3..5601c70c 100644
> --- a/ltp/fsx.c
> +++ b/ltp/fsx.c
> @@ -121,7 +121,7 @@ char	*bname;				/* basename of our test file */
>   char	*logdev;			/* -i flag */
>   char	*logid;				/* -j flag */
>   char	dname[1024];			/* -P flag */
> -char	goodfile[1024];
> +char	goodfile[PATH_MAX];
>   int	dirpath = 0;			/* -P flag */
>   int	fd;				/* fd for our test file */
>   
> @@ -185,7 +185,7 @@ const char *replayops = NULL;
>   const char *recordops = NULL;
>   FILE *	fsxlogf = NULL;
>   FILE *	replayopsf = NULL;
> -char opsfile[1024];
> +char opsfile[PATH_MAX];
>   int badoff = -1;
>   int closeopen = 0;
>   
> @@ -541,13 +541,13 @@ mark_log(void)
>   void
>   dump_fsync_buffer(void)
>   {
> -	char fname_buffer[1024];
> +	char fname_buffer[PATH_MAX];
>   	int good_fd;
>   
>   	if (!good_buf)
>   		return;
>   
> -	snprintf(fname_buffer, 1024, "%s%s.mark%d", dname,
> +	snprintf(fname_buffer, sizeof(fname_buffer), "%s%s.mark%d", dname,
>   		 bname, mark_nr);
>   	good_fd = open(fname_buffer, O_WRONLY|O_CREAT|O_TRUNC, 0666);
>   	if (good_fd < 0) {
> @@ -1865,7 +1865,7 @@ main(int argc, char **argv)
>   {
>   	int	i, style, ch;
>   	char	*endp, *tmp;
> -	char logfile[1024];
> +	char logfile[PATH_MAX];
>   	struct stat statbuf;
>   	int o_flags = O_RDWR|O_CREAT|O_TRUNC;
>   
>

Patch
diff mbox series

diff --git a/ltp/fsx.c b/ltp/fsx.c
index b0157ba3..5601c70c 100644
--- a/ltp/fsx.c
+++ b/ltp/fsx.c
@@ -121,7 +121,7 @@  char	*bname;				/* basename of our test file */
 char	*logdev;			/* -i flag */
 char	*logid;				/* -j flag */
 char	dname[1024];			/* -P flag */
-char	goodfile[1024];
+char	goodfile[PATH_MAX];
 int	dirpath = 0;			/* -P flag */
 int	fd;				/* fd for our test file */
 
@@ -185,7 +185,7 @@  const char *replayops = NULL;
 const char *recordops = NULL;
 FILE *	fsxlogf = NULL;
 FILE *	replayopsf = NULL;
-char opsfile[1024];
+char opsfile[PATH_MAX];
 int badoff = -1;
 int closeopen = 0;
 
@@ -541,13 +541,13 @@  mark_log(void)
 void
 dump_fsync_buffer(void)
 {
-	char fname_buffer[1024];
+	char fname_buffer[PATH_MAX];
 	int good_fd;
 
 	if (!good_buf)
 		return;
 
-	snprintf(fname_buffer, 1024, "%s%s.mark%d", dname,
+	snprintf(fname_buffer, sizeof(fname_buffer), "%s%s.mark%d", dname,
 		 bname, mark_nr);
 	good_fd = open(fname_buffer, O_WRONLY|O_CREAT|O_TRUNC, 0666);
 	if (good_fd < 0) {
@@ -1865,7 +1865,7 @@  main(int argc, char **argv)
 {
 	int	i, style, ch;
 	char	*endp, *tmp;
-	char logfile[1024];
+	char logfile[PATH_MAX];
 	struct stat statbuf;
 	int o_flags = O_RDWR|O_CREAT|O_TRUNC;