From: Matthew Vernon Date: Fri, 7 Nov 2025 11:43:15 +0000 (+0000) Subject: Check return value of read(2) X-Git-Tag: archive/debian/4.40~3 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~matthewv/git?a=commitdiff_plain;h=cdc958b8a2560c44d8f8f368c880969173785265;p=bible-kjv.git Check return value of read(2) Again, picked up by newer tooling. squish.c:648:25: error: ignoring return value of ‘read’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result] --- diff --git a/squish.c b/squish.c index 91c866e..2c1607a 100644 --- a/squish.c +++ b/squish.c @@ -645,7 +645,9 @@ int main(int argc,char **argv) fprintf(stderr, " do you wish to overwrite %s (y or n)? ", ofname); fflush(stderr); - read(2, response, 2); + if (read(2, response, 2) < 1) { + perror("stderr"); break; + } while (response[1] != '\n') { if (read(2, response+1, 1) < 0) { /* Ack! */ perror("stderr"); break;