test-mkostemp-child.c 482 B

12345678910111213141516171819202122
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <unistd.h>
  4. int main(int argc, char *argv[]) {
  5. int fd;
  6. /* This file gets built and run as a test, but its
  7. * really just a helper for test-mkostemp-O_CLOEXEC.c.
  8. * So, we'll always return succcess.
  9. */
  10. if(argc != 2)
  11. exit(EXIT_SUCCESS);
  12. sscanf(argv[1], "%d", &fd);
  13. if(write(fd, "test\0", 5) == -1)
  14. ; /* Don't Panic! Failure is okay here. */
  15. close(fd);
  16. exit(EXIT_SUCCESS);
  17. }