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

source code of libc/test/integration/src/spawn/posix_spawn_test_binary.cpp