[flang] Fix length handling in character kind implicit conversion (#74586)
[llvm-project.git] / libc / test / integration / src / spawn / posix_spawn_test_binary.cpp
blob7aec39c19292874193eef9d78a0e8a82ae795f3a
1 #include "test_binary_properties.h"
2 #include <errno.h>
3 #include <string.h>
4 #include <unistd.h>
6 int 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(CHILD_FD, buf, readsize);
13 if (len != readsize) {
14 return 1;
16 buf[readsize] = '\0'; // Null terminator
17 if (close(CHILD_FD) != 0)
18 return 2;
19 if (strcmp(buf, TEXT) != 0)
20 return 3;
21 return 0;