summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlistair Popple <alistair@popple.id.au>2017-07-14 16:44:00 +1000
committerAlistair Popple <alistair@popple.id.au>2017-07-14 16:44:00 +1000
commitcd727dbea1ddbfb220856e7ba366bd8bee3d2fc0 (patch)
tree73eeadaf6f0fbc253ddb5814b6fe24d870b5d4ca
parent55d558edbe6f207150ef0e76bd22a5bba6d8cc3b (diff)
downloadpdbg-cd727dbea1ddbfb220856e7ba366bd8bee3d2fc0.tar.gz
pdbg-cd727dbea1ddbfb220856e7ba366bd8bee3d2fc0.zip
src/main.c: Check result of writing to stdout
Fixes a compilation error due to an unused result on some systems. Signed-off-by: Alistair Popple <alistair@popple.id.au>
-rw-r--r--src/main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 2ef9326..7531ce3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -774,8 +774,10 @@ int main(int argc, char *argv[])
assert(buf);
for_each_class_target("adu", target) {
if (!adu_getmem(target, cmd_args[0], buf, cmd_args[1])) {
- write(STDOUT_FILENO, buf, cmd_args[1]);
- rc++;
+ if (write(STDOUT_FILENO, buf, cmd_args[1]) < 0)
+ PR_ERROR("Unable to write stdout.\n");
+ else
+ rc++;
} else
PR_ERROR("Unable to read memory.\n");
OpenPOWER on IntegriCloud