From: Jens Axboe Date: Sun, 8 Apr 2018 21:46:17 +0000 (-0600) Subject: client: fix bad shadowing of 'ret' X-Git-Tag: fio-3.6~12 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=583e0dfa7479be45b8a5ab7a53c9de88139683e4 client: fix bad shadowing of 'ret' Different scopes for ret, introduce 'wrote' to check the return value of write(2). Signed-off-by: Jens Axboe --- diff --git a/client.c b/client.c index 970974a0..ea1a4d29 100644 --- a/client.c +++ b/client.c @@ -1339,7 +1339,7 @@ static int fio_client_handle_iolog(struct fio_client *client, sprintf(log_pathname, "%s.%s", pdu->name, client->hostname); if (store_direct) { - ssize_t ret; + ssize_t wrote; size_t sz; int fd; @@ -1353,10 +1353,10 @@ static int fio_client_handle_iolog(struct fio_client *client, } sz = cmd->pdu_len - sizeof(*pdu); - ret = write(fd, pdu->samples, sz); + wrote = write(fd, pdu->samples, sz); close(fd); - if (ret != sz) { + if (wrote != sz) { log_err("fio: short write on compressed log\n"); ret = 1; goto out;