Browse Source

add note about racecondition

Mike Frysinger 19 years ago
parent
commit
71b20283a6
1 changed files with 5 additions and 0 deletions
  1. 5 0
      libc/misc/dirent/opendir.c

+ 5 - 0
libc/misc/dirent/opendir.c

@@ -42,6 +42,11 @@ DIR *opendir(const char *name)
 #endif
 	if ((fd = open(name, O_RDONLY|O_NDELAY|O_DIRECTORY)) < 0)
 		return NULL;
+	/* Note: we should check to make sure that between the stat() and open()
+	 * call, 'name' didnt change on us, but that's only if O_DIRECTORY isnt
+	 * defined and since Linux has supported it for like ever, i'm not going
+	 * to worry about it right now (if ever). */
+
 	/* According to POSIX, directory streams should be closed when
 	 * exec. From "Anna Pluzhnikov" <besp@midway.uchicago.edu>.
 	 */