From 793ca3c52a9ba6a1723e5ad767449f8b69ac19a8 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Fri, 17 Jul 2009 22:43:19 +0000 Subject: fix build warnings in 'client-protocol' Signed-off-by: Anand V. Avati BUG: 130 (build warnings) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=130 --- xlators/protocol/client/src/client-protocol.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'xlators/protocol') diff --git a/xlators/protocol/client/src/client-protocol.c b/xlators/protocol/client/src/client-protocol.c index 599872456..bbeffaa1e 100644 --- a/xlators/protocol/client/src/client-protocol.c +++ b/xlators/protocol/client/src/client-protocol.c @@ -3274,11 +3274,18 @@ client_setdents (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags, uint32_t mtime_nsec = ST_MTIM_NSEC(stbuf); uint32_t ctime_nsec = ST_CTIM_NSEC(stbuf); - asprintf (&tmp_buf, GF_STAT_PRINT_FMT_STR, - dev, ino, mode, nlink, uid, gid, - rdev, size, blksize, blocks, - atime, atime_nsec, mtime, mtime_nsec, - ctime, ctime_nsec); + ret = asprintf (&tmp_buf, GF_STAT_PRINT_FMT_STR, + dev, ino, mode, nlink, uid, gid, + rdev, size, blksize, blocks, + atime, atime_nsec, mtime, mtime_nsec, + ctime, ctime_nsec); + if (-1 == ret) { + gf_log (this->name, GF_LOG_ERROR, + "asprintf failed while setting stat " + "buf to string"); + STACK_UNWIND (frame, -1, ENOMEM); + return 0; + } } this_len = sprintf (ptr, "%s/%s%s\n", trav->name, tmp_buf, trav->link); @@ -5968,8 +5975,13 @@ protocol_client_handshake (xlator_t *this, transport_t *trans) GF_PROTOCOL_VERSION); } - asprintf (&process_uuid_xl, "%s-%s", this->ctx->process_uuid, - this->name); + ret = asprintf (&process_uuid_xl, "%s-%s", this->ctx->process_uuid, + this->name); + if (-1 == ret) { + gf_log (this->name, GF_LOG_ERROR, + "asprintf failed while setting process_uuid"); + goto fail; + } ret = dict_set_dynstr (options, "process-uuid", process_uuid_xl); if (ret < 0) { -- cgit