[launchd-changes] [23109] trunk/launchd/src/wait4path.c
source_changes at macosforge.org
source_changes at macosforge.org
Sun Feb 25 15:43:11 PST 2007
Revision: 23109
http://trac.macosforge.org/projects/launchd/changeset/23109
Author: zarzycki at 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);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20070225/f06bc756/attachment.html
More information about the launchd-changes
mailing list