| 1 | #include "test_binary_properties.h" |
|---|---|
| 2 | #include <string.h> |
| 3 | #include <unistd.h> |
| 4 | |
| 5 | int main(int argc, char **argv) { |
| 6 | if (argc != 1) |
| 7 | return 5; |
| 8 | constexpr size_t bufsize = sizeof(TEXT); |
| 9 | char buf[bufsize]; |
| 10 | ssize_t readsize = bufsize - 1; |
| 11 | ssize_t len = read(fd: CHILD_FD, buf: buf, nbytes: readsize); |
| 12 | if (len != readsize) { |
| 13 | return 1; |
| 14 | } |
| 15 | buf[readsize] = '\0'; // Null terminator |
| 16 | if (close(fd: CHILD_FD) != 0) |
| 17 | return 2; |
| 18 | if (strcmp(s1: buf, s2: TEXT) != 0) |
| 19 | return 3; |
| 20 | return 0; |
| 21 | } |
| 22 |
