From: Anders Kaseorg Date: Sat, 1 Aug 2015 03:26:43 +0000 (-0400) Subject: tests/auth/keys-t.c: Don’t ignore return value of write X-Git-Tag: upstream/1.8.0_pre1^2~268 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=fcfa8d039a56d051838142cc5b361be195d225e3;p=packages%2Fo%2Fopenafs.git tests/auth/keys-t.c: Don’t ignore return value of write 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 --- 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);