diff options
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-snapd-svc-helper.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-snapd-svc-helper.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapd-svc-helper.c b/xlators/mgmt/glusterd/src/glusterd-snapd-svc-helper.c index b2e06825c32..8f1630f1871 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapd-svc-helper.c +++ b/xlators/mgmt/glusterd/src/glusterd-snapd-svc-helper.c @@ -29,10 +29,14 @@ glusterd_svc_build_snapd_socket_filepath (glusterd_volinfo_t *volinfo, { char sockfilepath[PATH_MAX] = {0,}; char rundir[PATH_MAX] = {0,}; + int32_t len = 0; glusterd_svc_build_snapd_rundir (volinfo, rundir, sizeof (rundir)); - snprintf (sockfilepath, sizeof (sockfilepath), "%s/run-%s", - rundir, uuid_utoa (MY_UUID)); + len = snprintf (sockfilepath, sizeof (sockfilepath), "%s/run-%s", + rundir, uuid_utoa (MY_UUID)); + if ((len < 0) || (len >= sizeof(sockfilepath))) { + sockfilepath[0] = 0; + } glusterd_set_socket_filepath (sockfilepath, path, path_len); } |