diff options
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/lib/src/libxlator.c | 14 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 8 | ||||
-rw-r--r-- | xlators/nfs/server/src/nfs3.c | 42 |
3 files changed, 47 insertions, 17 deletions
diff --git a/xlators/lib/src/libxlator.c b/xlators/lib/src/libxlator.c index bd0e11d21..3991d80ff 100644 --- a/xlators/lib/src/libxlator.c +++ b/xlators/lib/src/libxlator.c @@ -45,13 +45,13 @@ cluster_markerxtime_cbk (call_frame_t *frame, void *cookie, xlator_t *this, { - int32_t callcnt = 0; - int ret = -1; - uint32_t *net_timebuf; - uint32_t host_timebuf[2]; - char *marker_xattr; - struct marker_str *local; - char *vol_uuid; + int32_t callcnt = 0; + int ret = -1; + uint32_t *net_timebuf = NULL; + uint32_t host_timebuf[2] = {0,}; + char *marker_xattr = NULL; + struct marker_str *local = NULL; + char *vol_uuid = NULL; if (!this || !frame || !frame->local || !cookie) { gf_log (this->name, GF_LOG_DEBUG, "possible NULL deref"); diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index e8d107db7..0ee0206fa 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -895,7 +895,9 @@ glusterd_service_stop (const char *service, char *pidfile, int sig, ret = 0; out: if (is_locked && file) - lockf (fileno (file), F_ULOCK, 0); + if (lockf (fileno (file), F_ULOCK, 0) < 0) + gf_log ("", GF_LOG_WARNING, "Cannot unlock pidfile: %s" + " reason: %s", pidfile, strerror(errno)); if (file) fclose (file); return ret; @@ -1085,7 +1087,9 @@ connect: goto out; out: if (is_locked && file) - lockf (fileno (file), F_ULOCK, 0); + if (lockf (fileno (file), F_ULOCK, 0) < 0) + gf_log ("", GF_LOG_WARNING, "Cannot unlock pidfile: %s" + " reason: %s", pidfile, strerror(errno)); if (file) fclose (file); return ret; diff --git a/xlators/nfs/server/src/nfs3.c b/xlators/nfs/server/src/nfs3.c index e43b666d8..13eb1c0eb 100644 --- a/xlators/nfs/server/src/nfs3.c +++ b/xlators/nfs/server/src/nfs3.c @@ -2548,11 +2548,12 @@ out: int nfs3svc_create (rpcsvc_request_t *req) { - char name[NFS_PATH_MAX]; - struct nfs3_fh dirfh = {{0}, }; - create3args args; - int ret = RPCSVC_ACTOR_ERROR; - uint64_t cverf = 0; + char name[NFS_PATH_MAX]; + struct nfs3_fh dirfh = {{0}, }; + create3args args; + int ret = RPCSVC_ACTOR_ERROR; + uint64_t cverf = 0; + uint64_t *cval; if (!req) return ret; @@ -2564,7 +2565,14 @@ nfs3svc_create (rpcsvc_request_t *req) goto rpcerr; } - cverf = *(uint64_t *)args.how.createhow3_u.verf; + cval = (uint64_t *)args.how.createhow3_u.verf; + if (cval) + cverf = *cval; + else { + gf_log(GF_NFS3, GF_LOG_ERROR, "Error getting createverf3 from args"); + goto rpcerr; + } + ret = nfs3_create (req, &dirfh, name, args.how.mode, &args.how.createhow3_u.obj_attributes, cverf); if ((ret < 0) && (ret != RPCSVC_ACTOR_IGNORE)) { @@ -4241,6 +4249,7 @@ nfs3svc_readdir (rpcsvc_request_t *req) struct nfs3_fh fh = {{0},}; int ret = RPCSVC_ACTOR_ERROR; uint64_t verf = 0; + uint64_t *cval; if (!req) return ret; @@ -4251,7 +4260,15 @@ nfs3svc_readdir (rpcsvc_request_t *req) goto rpcerr; } - verf = *(uint64_t *)ra.cookieverf; + cval = (uint64_t *) ra.cookieverf; + + if (cval) + verf = *cval; + else { + gf_log(GF_NFS3, GF_LOG_ERROR, "Error getting cookieverf from readdir args"); + goto rpcerr; + } + ret = nfs3_readdir (req, &fh, ra.cookie, verf, ra.count, 0); if ((ret < 0) && (ret != RPCSVC_ACTOR_IGNORE)) { gf_log (GF_NFS3, GF_LOG_ERROR, "READDIR procedure failed"); @@ -4271,6 +4288,7 @@ nfs3svc_readdirp (rpcsvc_request_t *req) struct nfs3_fh fh = {{0},}; int ret = RPCSVC_ACTOR_ERROR; uint64_t cverf = 0; + uint64_t *cval; if (!req) return ret; @@ -4281,7 +4299,15 @@ nfs3svc_readdirp (rpcsvc_request_t *req) goto rpcerr; } - cverf = *(uint64_t *)ra.cookieverf; + cval = (uint64_t *) ra.cookieverf; + + if (cval) + cverf = *cval; + else { + gf_log (GF_NFS3, GF_LOG_ERROR, "Error getting cookieverf from readdirp args"); + goto rpcerr; + } + ret = nfs3_readdir (req, &fh, ra.cookie, cverf, ra.dircount, ra.maxcount); if ((ret < 0) && (ret != RPCSVC_ACTOR_IGNORE)) { |