From fcfa8d039a56d051838142cc5b361be195d225e3 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Fri, 31 Jul 2015 23:26:43 -0400 Subject: [PATCH] =?utf8?q?tests/auth/keys-t.c:=20Don=E2=80=99t=20ignore=20?= =?utf8?q?return=20value=20of=20write?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Resolves this warning: keys-t.c: In function ‘copy’: keys-t.c:63:6: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result] write(out, block, len); ^ Change-Id: If2427f2658b428091ffba3d11643ad95f193a67d Reviewed-on: http://gerrit.openafs.org/11957 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot --- tests/auth/keys-t.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/auth/keys-t.c b/tests/auth/keys-t.c index 5c483c537..789b49bc2 100644 --- a/tests/auth/keys-t.c +++ b/tests/auth/keys-t.c @@ -45,8 +45,9 @@ static int copy(char *inFile, char *outFile) { int in, out; - char *block; - size_t len; + char *block, *block_out; + ssize_t len; + size_t len_out; in = open(inFile, O_RDONLY); if (in<0) @@ -59,8 +60,17 @@ copy(char *inFile, char *outFile) block = malloc(1024); do { len = read(in, block, 1024); - if (len > 0) - write(out, block, len); + if (len <= 0) + break; + len_out = len; + block_out = block; + do { + len = write(out, block_out, len_out); + if (len <= 0) + break; + block_out += len; + len_out -= len; + } while (len_out > 0); } while (len > 0); free(block); -- 2.39.5