path-resolution-race.cpp 236 B

12345678910111213141516
  1. #include <unistd.h>
  2. #include <sys/stat.h>
  3. int main()
  4. {
  5. if (!fork()) {
  6. for (;;) {
  7. mkdir("/tmp/x", 0666);
  8. rmdir("/tmp/x");
  9. }
  10. }
  11. for (;;) {
  12. chdir("/tmp/x");
  13. }
  14. return 0;
  15. }