Introduction
Introduction Statistics Contact Development Disclaimer Help
Merge branch 'master' into experimental - sam - An updated version of the sam t…
git clone git://vernunftzentrum.de/sam.git
Log
Files
Refs
LICENSE
---
commit 84b051c7d9d429d3f6dda596a9d01e9a85652c82
parent 97562b07dcb8e2eca6523d2820f504275c6a9bb4
Author: Rob King <[email protected]>
Date: Thu, 20 Oct 2016 17:11:56 -0500
Merge branch 'master' into experimental
Diffstat:
rsam/rsam.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/rsam/rsam.c b/rsam/rsam.c
@@ -20,6 +20,7 @@
#define CHILD_READ writepipe[0]
#define PARENT_WRITE writepipe[1]
#define MAX(x, y) ((x) > (y) ? (x) : (y))
+#define CHECKEDWRITE(f, b, c) if (write(f, b, c) != c) exit(EXIT_FAILURE)
char path[PATH_MAX + 1];
@@ -92,7 +93,7 @@ main(int argc, char **argv)
count = read(STDIN_FILENO, buf, 8192);
if (count <= 0)
exit(EXIT_SUCCESS);
- write(PARENT_WRITE, buf, count);
+ CHECKEDWRITE(PARENT_WRITE, buf, count);
}
if (FD_ISSET(fifo, &rfds)){
@@ -100,15 +101,15 @@ main(int argc, char **argv)
count = read(fifo, buf, 253);
if (count <= 0)
exit(EXIT_SUCCESS);
- write(STDOUT_FILENO, "\x19\xff\x00", 3);
- write(STDOUT_FILENO, buf, 255);
+ CHECKEDWRITE(STDOUT_FILENO, "\x19\xff\x00", 3);
+ CHECKEDWRITE(STDOUT_FILENO, buf, 255);
}
if (FD_ISSET(PARENT_READ, &rfds)){
count = read(PARENT_READ, buf, 8192);
if (count <= 0)
exit(EXIT_SUCCESS);
- write(STDOUT_FILENO, buf, count);
+ CHECKEDWRITE(STDOUT_FILENO, buf, count);
}
FD_ZERO(&rfds);
You are viewing proxied material from vernunftzentrum.de. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.