summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
915215b)
gdb/
2013-10-09 Jan Kratochvil <jan.kratochvil@redhat.com>
* common/filestuff.c (gdb_fopen_cloexec): Remove initialization of
result variable. Rename variable fopen_e_ever_failed to
fopen_e_ever_failed_einval. Retry fopen only for errno EINVAL.
+2013-10-09 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * common/filestuff.c (gdb_fopen_cloexec): Remove initialization of
+ result variable. Rename variable fopen_e_ever_failed to
+ fopen_e_ever_failed_einval. Retry fopen only for errno EINVAL.
+
2013-10-09 Pedro Alves <palves@redhat.com>
* monitor.c (monitor_write_memory, monitor_write_memory_bytes)
2013-10-09 Pedro Alves <palves@redhat.com>
* monitor.c (monitor_write_memory, monitor_write_memory_bytes)
FILE *
gdb_fopen_cloexec (const char *filename, const char *opentype)
{
FILE *
gdb_fopen_cloexec (const char *filename, const char *opentype)
{
/* Probe for "e" support once. But, if we can tell the operating
system doesn't know about close on exec mode "e" without probing,
skip it. E.g., the Windows runtime issues an "Invalid parameter
passed to C runtime function" OutputDebugString warning for
unknown modes. Assume that if O_CLOEXEC is zero, then "e" isn't
supported. */
/* Probe for "e" support once. But, if we can tell the operating
system doesn't know about close on exec mode "e" without probing,
skip it. E.g., the Windows runtime issues an "Invalid parameter
passed to C runtime function" OutputDebugString warning for
unknown modes. Assume that if O_CLOEXEC is zero, then "e" isn't
supported. */
- static int fopen_e_ever_failed = O_CLOEXEC == 0;
+ static int fopen_e_ever_failed_einval = O_CLOEXEC == 0;
- if (!fopen_e_ever_failed)
+ if (!fopen_e_ever_failed_einval)
this path. */
strcat (copy, "e");
result = fopen (filename, copy);
this path. */
strcat (copy, "e");
result = fopen (filename, copy);
- if (result == NULL)
- {
- /* Fallback. */
- result = fopen (filename, opentype);
- if (result != NULL)
- fopen_e_ever_failed = 1;
+ if (result == NULL && errno == EINVAL)
+ {
+ result = fopen (filename, opentype);
+ if (result != NULL)
+ fopen_e_ever_failed_einval = 1;
+ }
+ else
+ result = fopen (filename, opentype);
if (result != NULL)
maybe_mark_cloexec (fileno (result));
if (result != NULL)
maybe_mark_cloexec (fileno (result));