Revision: 23109 http://trac.macosforge.org/projects/launchd/changeset/23109 Author: zarzycki@apple.com Date: 2007-02-25 15:43:10 -0800 (Sun, 25 Feb 2007) Log Message: ----------- Fix a small race (never seen in practice). Modified Paths: -------------- trunk/launchd/src/wait4path.c Modified: trunk/launchd/src/wait4path.c =================================================================== --- trunk/launchd/src/wait4path.c 2007-02-25 23:32:43 UTC (rev 23108) +++ trunk/launchd/src/wait4path.c 2007-02-25 23:43:10 UTC (rev 23109) @@ -39,9 +39,6 @@ exit(EXIT_FAILURE); } - if (stat(argv[1], &sb) == 0) - exit(EXIT_SUCCESS); - EV_SET(&kev, 0, EVFILT_FS, EV_ADD, 0, 0, 0); if (kevent(kq, &kev, 1, NULL, 0, NULL) == -1) { @@ -49,10 +46,15 @@ exit(EXIT_FAILURE); } + if (stat(argv[1], &sb) == 0) { + exit(EXIT_SUCCESS); + } + for (;;) { kevent(kq, NULL, 0, &kev, 1, NULL); - if (stat(argv[1], &sb) == 0) + if (stat(argv[1], &sb) == 0) { break; + } } exit(EXIT_SUCCESS);
participants (1)
-
source_changes@macosforge.org