summaryrefslogtreecommitdiffstats
path: root/cmd/ztest
diff options
context:
space:
mode:
authorRichard Yao <ryao@gentoo.org>2013-07-02 00:07:15 -0400
committerBrian Behlendorf <behlendorf1@llnl.gov>2013-07-02 10:39:24 -0700
commit3db3ff4a787acf068b122562fb5be5aecec2611f (patch)
treeedf41a3f51770a5aeb82fdd1d4c300efd53c0267 /cmd/ztest
parent29dee3ee9ac68d8a75c0d518b1342f447cd2ddc0 (diff)
Use MAXPATHLEN instead of sizeof in snprintf
This silences a GCC 4.8.0 warning by fixing a programming error caught by static analysis: ../../cmd/ztest/ztest.c: In function ‘ztest_vdev_aux_add_remove’: ../../cmd/ztest/ztest.c:2584:33: error: argument to ‘sizeof’ in ‘snprintf’ call is the same expression as the destination; did you mean to provide an explicit length? [-Werror=sizeof-pointer-memaccess] (void) snprintf(path, sizeof (path), ztest_aux_template, ^ Signed-off-by: Richard Yao <ryao@gentoo.org> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #1480
Diffstat (limited to 'cmd/ztest')
-rw-r--r--cmd/ztest/ztest.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c
index b38d7b1d0..93a5f1ecf 100644
--- a/cmd/ztest/ztest.c
+++ b/cmd/ztest/ztest.c
@@ -2581,7 +2581,7 @@ ztest_vdev_aux_add_remove(ztest_ds_t *zd, uint64_t id)
zs->zs_vdev_aux = 0;
for (;;) {
int c;
- (void) snprintf(path, sizeof (path), ztest_aux_template,
+ (void) snprintf(path, MAXPATHLEN, ztest_aux_template,
ztest_opts.zo_dir, ztest_opts.zo_pool, aux,
zs->zs_vdev_aux);
for (c = 0; c < sav->sav_count; c++)