diff options
author | Alistair Popple <alistair@popple.id.au> | 2017-07-14 16:44:00 +1000 |
---|---|---|
committer | Alistair Popple <alistair@popple.id.au> | 2017-07-14 16:44:00 +1000 |
commit | cd727dbea1ddbfb220856e7ba366bd8bee3d2fc0 (patch) | |
tree | 73eeadaf6f0fbc253ddb5814b6fe24d870b5d4ca | |
parent | 55d558edbe6f207150ef0e76bd22a5bba6d8cc3b (diff) | |
download | pdbg-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.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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"); |