summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd.c
diff options
context:
space:
mode:
authorKaleb S. KEITHLEY <kkeithle@redhat.com>2018-11-16 12:46:49 -0500
committerAtin Mukherjee <amukherj@redhat.com>2018-11-19 15:09:56 +0000
commitbdf8d8684fa4814cf055350db38f53618c5de6ae (patch)
tree657de42ed2325f57bc069a8f74a71da12d27c2e3 /xlators/mgmt/glusterd/src/glusterd.c
parent60689bd26f0c9cb9e761f2cf8c5f2b90e39884eb (diff)
core: fix strncpy, coverity annotation
For added fun, coverity is not smart enough to detect that the strncpy() is safe, and for extra laughs, using coverity annotations doesn't do anything either; but we're adding them anyway, along with marking the BUFFER_SIZE_WARNINGS as false positives on scan.coverity.com. Change-Id: If7fa157eca565842109f32fee0399ac183b19ec7 updates: bz#1193929 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index bbc9d317a9d..e79d2813655 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -1825,17 +1825,22 @@ init(xlator_t *this)
conf->gfs_mgmt = &gd_brick_prog;
this->private = conf;
/* conf->workdir and conf->rundir are smaller than PATH_MAX; gcc's
- * snprintf checking will throw an error here if sprintf is used. */
+ * snprintf checking will throw an error here if sprintf is used.
+ * Dueling gcc-8 and coverity, now coverity isn't smart enough to
+ * detect that these strncpy calls are safe. And for extra fun,
+ * the annotations don't do anything. */
if (strlen(workdir) >= sizeof(conf->workdir)) {
ret = -1;
goto out;
}
+ /* coverity[BUFFER_SIZE_WARNING] */
(void)strncpy(conf->workdir, workdir, sizeof(conf->workdir));
/* separate tests because combined tests confuses gcc */
if (strlen(rundir) >= sizeof(conf->rundir)) {
ret = -1;
goto out;
}
+ /* coverity[BUFFER_SIZE_WARNING] */
(void)strncpy(conf->rundir, rundir, sizeof(conf->rundir));
synclock_init(&conf->big_lock, SYNC_LOCK_RECURSIVE);