+2006-02-24 Charles Wilson <cygwin@cwilson.fastmail.fm>
+
+ * gdb/defs.h: unconditionally include <fcntl.h>, and
+ ensure that O_BINARY is defined.
+ * gdb/solib.c(solib_open): ensure solib files are opened in
+ binary mode.
+ * gdb/corelow.c: Remove O_BINARY macro definition.
+ * gdb/exec.c: Remove O_BINARY macro definition
+ * gdb/remote-rdp.c: Remove O_BINARY macro definition
+ * gdb/source.c: Remove O_BINARY macro definition
+ * gdb/symfile.c: Remove O_BINARY macro definition
+
2006-02-24 Randolph Chung <tausq@debian.org>
* hppa-hpux-tdep.c (hppa_hpux_push_dummy_code): Initialize
#include <unistd.h>
#endif
+#include <fcntl.h>
+
/* First include ansidecl.h so we can use the various macro definitions
here and in all subsequent file inclusions. */
#define SEEK_CUR 1
#endif
+/* The O_BINARY flag is defined in fcntl.h on some non-Posix platforms.
+ It is used as an access modifier in calls to open(), where it acts
+ similarly to the "b" character in fopen()'s MODE argument. On Posix
+ platforms it should be a no-op, so it is defined as 0 here. This
+ ensures that the symbol may be used freely elsewhere in gdb. */
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
#include <stdarg.h> /* For va_list. */
#include "libiberty.h"
}
/* Now see if we can open it. */
- found_file = open (temp_pathname, O_RDONLY, 0);
+ found_file = open (temp_pathname, O_RDONLY | O_BINARY, 0);
}
/* If the search in solib_absolute_prefix failed, and the path name is
/* If not found, search the solib_search_path (if any). */
if (found_file < 0 && solib_search_path != NULL)
found_file = openp (solib_search_path, OPF_TRY_CWD_FIRST,
- in_pathname, O_RDONLY, 0, &temp_pathname);
+ in_pathname, O_RDONLY | O_BINARY, 0, &temp_pathname);
/* If not found, next search the solib_search_path (if any) for the basename
only (ignoring the path). This is to allow reading solibs from a path
that differs from the opened path. */
if (found_file < 0 && solib_search_path != NULL)
found_file = openp (solib_search_path, OPF_TRY_CWD_FIRST,
- lbasename (in_pathname), O_RDONLY, 0,
+ lbasename (in_pathname), O_RDONLY | O_BINARY, 0,
&temp_pathname);
/* If not found, try to use target supplied solib search method */
if (found_file < 0 && ops->find_and_open_solib)
- found_file = ops->find_and_open_solib (in_pathname, O_RDONLY,
+ found_file = ops->find_and_open_solib (in_pathname, O_RDONLY | O_BINARY,
&temp_pathname);
/* If not found, next search the inferior's $PATH environment variable. */
if (found_file < 0 && solib_absolute_prefix == NULL)
found_file = openp (get_in_environ (inferior_environ, "PATH"),
- OPF_TRY_CWD_FIRST, in_pathname, O_RDONLY, 0,
+ OPF_TRY_CWD_FIRST, in_pathname, O_RDONLY | O_BINARY, 0,
&temp_pathname);
/* If not found, next search the inferior's $LD_LIBRARY_PATH
environment variable. */
if (found_file < 0 && solib_absolute_prefix == NULL)
found_file = openp (get_in_environ (inferior_environ, "LD_LIBRARY_PATH"),
- OPF_TRY_CWD_FIRST, in_pathname, O_RDONLY, 0,
+ OPF_TRY_CWD_FIRST, in_pathname, O_RDONLY | O_BINARY, 0,
&temp_pathname);
/* Done. If not found, tough luck. Return found_file and