From: wenpengLi Date: Tue, 13 Aug 2019 03:45:50 +0000 (+0800) Subject: client: fix return code handling from _lseek X-Git-Tag: v15.1.0~1256^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d5c0710dcc7f362cb254bbdb860fe44fe8f84ef5;p=ceph.git client: fix return code handling from _lseek The return type of _lseek is loff_t, but int r = _lseek in write may cause an overflow. It would be better to change it to auto, for example auto r = _lseek. Signed-off-by: wenpengLi --- diff --git a/src/client/Client.cc b/src/client/Client.cc index a1b2bfee15f2..68fb6a4ebca6 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -9433,7 +9433,7 @@ int64_t Client::_write(Fh *f, int64_t offset, uint64_t size, const char *buf, * change out from under us. */ if (f->flags & O_APPEND) { - int r = _lseek(f, 0, SEEK_END); + auto r = _lseek(f, 0, SEEK_END); if (r < 0) { unlock_fh_pos(f); return r;