diff options
| author | Emmanuel Dreyfus <manu@netbsd.org> | 2014-09-16 17:11:39 +0200 | 
|---|---|---|
| committer | Vijay Bellur <vbellur@redhat.com> | 2014-09-25 10:34:18 -0700 | 
| commit | adace43107e3a77dcb3d24c87e7a631c0f099602 (patch) | |
| tree | 2d72f6313cbe835a4040a12c377bc94283754ea7 | |
| parent | 94b0ac65c35d5e167d8e761f198edffe78c7dab2 (diff) | |
32 bit fix: use off_t and not size_t for truncate()
Make sure off_t and not size_t is used when holding file offsets for
ftruncate()/truncate(). It works on 64 bit machines where
sizeof(size_t) == sizeof(off_t) == 8, but breaks for big offsets on 32 bit
machines because sizeof(size_t) == 4 and sizeof(off_t) == 8
BUG: 1129939
Change-Id: Ia2637be772ba9b11731d59fdbffbd269f0ff56c8
Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org>
Reviewed-on: http://review.gluster.org/8742
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
| -rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.c | 14 | 
1 files changed, 7 insertions, 7 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index dd51f5a6608..17335492465 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -1010,14 +1010,14 @@ out:  }  static void -fuse_do_truncate (fuse_state_t *state, size_t size) +fuse_do_truncate (fuse_state_t *state)  {          if (state->fd) {                  FUSE_FOP (state, fuse_truncate_cbk, GF_FOP_FTRUNCATE, -                          ftruncate, state->fd, size, state->xdata); +                          ftruncate, state->fd, state->off, state->xdata);          } else {                  FUSE_FOP (state, fuse_truncate_cbk, GF_FOP_TRUNCATE, -                          truncate, &state->loc, size, state->xdata); +                          truncate, &state->loc, state->off, state->xdata);          }          return; @@ -1059,7 +1059,7 @@ fuse_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,                          calc_timeout_nsec (priv->attribute_timeout);                  if (state->truncate_needed) { -                        fuse_do_truncate (state, state->size); +                        fuse_do_truncate (state);                  } else {  #if FUSE_KERNEL_MINOR_VERSION >= 9                          priv->proto_minor >= 9 ? @@ -1166,7 +1166,7 @@ fuse_setattr_resume (fuse_state_t *state)                                    state->xdata);                  }          } else { -                fuse_do_truncate (state, state->size); +                fuse_do_truncate (state);          }  } @@ -1216,7 +1216,7 @@ fuse_setattr (xlator_t *this, fuse_in_header_t *finh, void *msg)          if ((fsi->valid & (FATTR_MASK)) != FATTR_SIZE) {                  if (fsi->valid & FATTR_SIZE) { -                        state->size            = fsi->size; +                        state->off             = fsi->size;                          state->truncate_needed = _gf_true;                  } @@ -1230,7 +1230,7 @@ fuse_setattr (xlator_t *this, fuse_in_header_t *finh, void *msg)                  state->attr.ia_uid  = fsi->uid;                  state->attr.ia_gid  = fsi->gid;          } else { -                state->size = fsi->size; +                state->off = fsi->size;          }          fuse_resolve_and_resume (state, fuse_setattr_resume);  | 
