summaryrefslogtreecommitdiff
path: root/bfd/bfdio.c
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2008-11-14 09:57:35 +0000
committerTristan Gingold <gingold@adacore.com>2008-11-14 09:57:35 +0000
commit658cc53aff59d7e39ef8f367e29a370ec121438b (patch)
treeea82eec76bf41ad241a8464457e72d88e41836fe /bfd/bfdio.c
parent2c13532d19e737a1f0c050249769f3627efcf87a (diff)
downloadbinutils-redhat-658cc53aff59d7e39ef8f367e29a370ec121438b.tar.gz
bfd/
2008-11-14 Tristan Gingold <gingold@adacore.com> * configure.com: Handle bfd_default_target_size, BFD_HOST_LONG_LONG, BFD_HOST_64BIT_LONG_LONG, BFD_HOSTPTR_T, bfd_file_ptr. Generate bfdver.h. * vms-hdr.c (_bfd_vms_write_hdr): Use strdup/free instead of alloca. * hosts/alphavms.h: Defines macros to bypass i18n. * makefile.vms (OBJS): Update file list. (DEFS): Remove VMS_DEBUG, const, add DEBUGDIR. (CFLAGS): Update flags. * bfdio.c (real_fopen): Add code specific to VMS: extract attributes from modes. binutils/ 2008-11-14 Tristan Gingold <gingold@adacore.com> * configure.com: Get version from configure.in of bfd. * makefile.vms-in (DEBUG_OBJS): Add dwarf.obj. (CFLAGS): Update flags. include/ 2008-11-14 Tristan Gingold <gingold@adacore.com> * fopen-vms.h (FOPEN_RB): Use a single string to match the standard prototype. (FOPEN_WB): Ditto. (FOPEN_AB): Ditto. (FOPEN_RUB): Ditto. (FOPEN_WUB): Ditto. (FOPEN_AUB): Ditto. libiberty/ 2008-11-14 Tristan Gingold <gingold@adacore.com> * makefile.vms (OBJS): Update objects list. (CFLAGS): Update. (libiberty.olb): Remove alloca-conf.h dependency. * config.h-vms: Use new macro sets, use builtin alloca. opcodes/ 2008-11-14 Tristan Gingold <gingold@adacore.com> * makefile.vms (OBJS): Update list of objects. (DEFS): Update (CFLAGS): Update.
Diffstat (limited to 'bfd/bfdio.c')
-rw-r--r--bfd/bfdio.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/bfd/bfdio.c b/bfd/bfdio.c
index cb06453e01..7cba51ff83 100644
--- a/bfd/bfdio.c
+++ b/bfd/bfdio.c
@@ -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 */
}
/*