[PATCH 4/4] btrfs-progs: Fix Wformat-overflow warning in cmds-receive.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[BUG]
When compiling btrfs-progs with GCC 9 (9.1.0), we got the following
warnings:
  In file included from utils.h:30,
                   from cmds-receive.c:45:
  cmds-receive.c: In function 'process_subvol':
  messages.h:42:3: warning: '%s' directive argument is null [-Wformat-overflow=]
     42 |   __btrfs_error((fmt), ##__VA_ARGS__);   \
        |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  cmds-receive.c:178:3: note: in expansion of macro 'error'
    178 |   error("subvol: another one already started, path buf: %s",
        |   ^~~~~
      [CC]     cmds-inspect-tree-stats.o
  cmds-receive.c: In function 'process_snapshot':
  messages.h:42:3: warning: '%s' directive argument is null [-Wformat-overflow=]
     42 |   __btrfs_error((fmt), ##__VA_ARGS__);   \
        |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  cmds-receive.c:248:3: note: in expansion of macro 'error'
    248 |   error("snapshot: another one already started, path buf: %s",
        |   ^~~~~

[FIX]
We're using wrong member for the error output.
Fix the member to output.

Signed-off-by: Qu Wenruo <wqu@xxxxxxxx>
---
 cmds-receive.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cmds-receive.c b/cmds-receive.c
index fe5c3a5b05c5..07f05101f921 100644
--- a/cmds-receive.c
+++ b/cmds-receive.c
@@ -176,7 +176,7 @@ static int process_subvol(const char *path, const u8 *uuid, u64 ctransid,
 	}
 	if (rctx->cur_subvol_path[0]) {
 		error("subvol: another one already started, path buf: %s",
-				rctx->cur_subvol.path);
+				rctx->cur_subvol_path);
 		ret = -EINVAL;
 		goto out;
 	}
@@ -246,7 +246,7 @@ static int process_snapshot(const char *path, const u8 *uuid, u64 ctransid,
 	}
 	if (rctx->cur_subvol_path[0]) {
 		error("snapshot: another one already started, path buf: %s",
-				rctx->cur_subvol.path);
+				rctx->cur_subvol_path);
 		ret = -EINVAL;
 		goto out;
 	}
-- 
2.22.0




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux