From d5c0710dcc7f362cb254bbdb860fe44fe8f84ef5 Mon Sep 17 00:00:00 2001 From: wenpengLi Date: Tue, 13 Aug 2019 11:45:50 +0800 Subject: [PATCH] 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 --- src/client/Client.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index a1b2bfee15f..68fb6a4ebca 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; -- 2.39.5