summaryrefslogtreecommitdiff
path: root/daemons/lvmlockd/lvmlockd-dlm.c
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2019-05-02 12:41:00 -0500
committerDavid Teigland <teigland@redhat.com>2019-05-02 12:59:55 -0500
commit81735b46d9c7ab8f2dd27835d2a43cc5ad705c86 (patch)
tree182c9f3160e1f1219e54450f32b7732846a6813b /daemons/lvmlockd/lvmlockd-dlm.c
parent0046c4e7a7f647096dc49df29f66bdaba4e11c00 (diff)
downloadlvm2-81735b46d9c7ab8f2dd27835d2a43cc5ad705c86.tar.gz
lvmlockd: fix snprintf warnings
Diffstat (limited to 'daemons/lvmlockd/lvmlockd-dlm.c')
-rw-r--r--daemons/lvmlockd/lvmlockd-dlm.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/daemons/lvmlockd/lvmlockd-dlm.c b/daemons/lvmlockd/lvmlockd-dlm.c
index bfc1d23c2..75e6deec4 100644
--- a/daemons/lvmlockd/lvmlockd-dlm.c
+++ b/daemons/lvmlockd/lvmlockd-dlm.c
@@ -128,16 +128,18 @@ static int read_cluster_name(char *clustername)
return 0;
}
+#define MAX_VERSION 16
+
int lm_init_vg_dlm(char *ls_name, char *vg_name, uint32_t flags, char *vg_args)
{
char clustername[MAX_ARGS+1];
- char lock_args_version[MAX_ARGS+1];
+ char lock_args_version[MAX_VERSION+1];
int rv;
memset(clustername, 0, sizeof(clustername));
memset(lock_args_version, 0, sizeof(lock_args_version));
- snprintf(lock_args_version, MAX_ARGS, "%u.%u.%u",
+ snprintf(lock_args_version, MAX_VERSION, "%u.%u.%u",
VG_LOCK_ARGS_MAJOR, VG_LOCK_ARGS_MINOR, VG_LOCK_ARGS_PATCH);
rv = read_cluster_name(clustername);
@@ -149,7 +151,9 @@ int lm_init_vg_dlm(char *ls_name, char *vg_name, uint32_t flags, char *vg_args)
return -EARGS;
}
- snprintf(vg_args, MAX_ARGS, "%s:%s", lock_args_version, clustername);
+ rv = snprintf(vg_args, MAX_ARGS, "%s:%s", lock_args_version, clustername);
+ if (rv >= MAX_ARGS)
+ log_debug("init_vg_dlm vg_args may be too long %d %s", rv, vg_args);
rv = 0;
log_debug("init_vg_dlm done %s vg_args %s", ls_name, vg_args);