Handle EINTR from opendir.
authorTaylor R Campbell <campbell@mumble.net>
Wed, 24 Nov 2010 18:29:14 +0000 (18:29 +0000)
committerTaylor R Campbell <campbell@mumble.net>
Wed, 24 Nov 2010 18:29:14 +0000 (18:29 +0000)
src/microcode/uxfs.c

index 459adef59baf8819fc44bfddbdcd1e9d55c00056..902d1018e658be8e02f6ce1c4bbdf12a4041a494 100644 (file)
@@ -602,9 +602,11 @@ OS_directory_valid_p (unsigned int index)
 unsigned int
 OS_directory_open (const char * name)
 {
-  DIR * pointer = (opendir (name));
-  if (pointer == 0)
-    error_system_call (errno, syscall_opendir);
+  DIR * pointer;
+  STD_PTR_SYSTEM_CALL (syscall_opendir, pointer, (opendir (name)));
+  /* FIXME: This leaks a directory pointer if malloc or realloc fails
+     here.  Avoiding this safely with a transaction is unfortunately
+     not straightforward.  */
   return (allocate_directory_pointer (pointer));
 }