* cris.h (R_CRIS_32_IE): New relocation.
[deliverable/binutils-gdb.git] / bfd / bfdio.c
index cb06453e0168d7b7ab859d0fb3a33741d2621f8f..7cba51ff83726f193e0ce01909004a47eef615ef 100644 (file)
@@ -86,11 +86,37 @@ close_on_exec (FILE *file)
 FILE *
 real_fopen (const char *filename, const char *modes)
 {
+#ifdef VMS
+  char vms_modes[4];
+  char *vms_attr;
+
+  /* On VMS, fopen allows file attributes as optionnal arguments.
+     We need to use them but we'd better to use the common prototype.
+     In fopen-vms.h, they are separated from the mode with a comma.
+     Split here.  */
+  vms_attr = strchr (modes, ',');
+  if (vms_attr == NULL)
+    {
+      /* No attributes.  */
+      return close_on_exec (fopen (filename, modes));
+    }
+  else
+    {
+      /* Attribute found - rebuild modes.  */
+      size_t modes_len = vms_attr - modes;
+
+      BFD_ASSERT (modes_len < sizeof (vms_modes));
+      memcpy (vms_modes, modes, modes_len);
+      vms_modes[modes_len] = 0;
+      return close_on_exec (fopen (filename, vms_modes, vms_attr + 1));
+    }
+#else /* !VMS */
 #if defined (HAVE_FOPEN64)
   return close_on_exec (fopen64 (filename, modes));
 #else
   return close_on_exec (fopen (filename, modes));
 #endif
+#endif /* !VMS */
 }
 
 /*
This page took 0.024737 seconds and 4 git commands to generate.