aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport/filestuff.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gdbsupport/filestuff.cc')
-rw-r--r--gdbsupport/filestuff.cc8
1 files changed, 2 insertions, 6 deletions
diff --git a/gdbsupport/filestuff.cc b/gdbsupport/filestuff.cc
index 5c1817e..817663b 100644
--- a/gdbsupport/filestuff.cc
+++ b/gdbsupport/filestuff.cc
@@ -333,14 +333,10 @@ gdb_fopen_cloexec (const char *filename, const char *opentype)
if (!fopen_e_ever_failed_einval)
{
- char *copy;
-
- copy = (char *) alloca (strlen (opentype) + 2);
- strcpy (copy, opentype);
/* This is a glibc extension but we try it unconditionally on
this path. */
- strcat (copy, "e");
- result = fopen (filename, copy);
+ auto opentype_e = std::string (opentype) + 'e';
+ result = fopen (filename, opentype_e.c_str ());
if (result == NULL && errno == EINVAL)
{