aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>2019-03-09 19:39:02 +0900
committerNikolaus Rath <Nikolaus@rath.org>2019-03-09 10:39:02 +0000
commitb394699a668e866f92019d9b3e8bfb29fec4eb28 (patch)
tree929a34cc539b0771367a96f35737257809e61ded /test
parent1c70c870fe688e3bcd3b3dc8e8951a79fcaef435 (diff)
downloadlibfuse-b394699a668e866f92019d9b3e8bfb29fec4eb28.tar.gz
Work around -Wformat-truncation=/-Wformat-overflow= warnings (#356)
sprintf(3)/snprintf(3) destination buffers need to be large enough so that gcc doesn't warn -Wformat-truncation= or -Wformat-overflow= when source buffer size is 1024 bytes. -- ../test/test_syscalls.c:1445:47: warning: '%s' directive output may be truncated writing 1 byte into a region of size between 0 and 1023 [-Wformat-truncation=] #define PATH(p) (snprintf(path, sizeof path, "%s/%s", testdir, p), path) ^~~~~~~ ../test/test_syscalls.c:1458:19: res = mkdir(PATH("a"), 0755); ~~~ Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/test_syscalls.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/test_syscalls.c b/test/test_syscalls.c
index cdf17d7..e9a5189 100644
--- a/test/test_syscalls.c
+++ b/test/test_syscalls.c
@@ -19,13 +19,13 @@ static char testfile[1024];
static char testfile2[1024];
static char testdir[1024];
static char testdir2[1024];
-static char subfile[1024];
+static char subfile[1280];
static char testfile_r[1024];
static char testfile2_r[1024];
static char testdir_r[1024];
static char testdir2_r[1024];
-static char subfile_r[1024];
+static char subfile_r[1280];
static char testname[256];
static char testdata[] = "abcdefghijklmnopqrstuvwxyz";
@@ -493,7 +493,7 @@ static int cleanup_dir(const char *path, const char **dir_files, int quiet)
for (i = 0; dir_files[i]; i++) {
int res;
- char fpath[1024];
+ char fpath[1280];
sprintf(fpath, "%s/%s", path, dir_files[i]);
res = unlink(fpath);
if (res == -1 && !quiet) {
@@ -526,7 +526,7 @@ static int create_dir(const char *path, const char **dir_files)
return -1;
for (i = 0; dir_files[i]; i++) {
- char fpath[1024];
+ char fpath[1280];
sprintf(fpath, "%s/%s", path, dir_files[i]);
res = create_file(fpath, "", 0);
if (res == -1) {
@@ -1447,7 +1447,7 @@ static int test_rename_dir_loop(void)
#define PATH(p) (snprintf(path, sizeof path, "%s/%s", testdir, p), path)
#define PATH2(p) (snprintf(path2, sizeof path2, "%s/%s", testdir, p), path2)
- char path[1024], path2[1024];
+ char path[1280], path2[1280];
int err = 0;
int res;