Index: gdb/common/linux-procfs.c |
diff --git a/gdb/common/linux-procfs.c b/gdb/common/linux-procfs.c |
index a5aa8305f7d855c4aca2c41f6ebbe4ac23aee51d..ec0f6c72fa00259ffcf5be27696c0b0a1c6e3b75 100644 |
--- a/gdb/common/linux-procfs.c |
+++ b/gdb/common/linux-procfs.c |
@@ -1,5 +1,5 @@ |
/* Linux-specific PROCFS manipulation routines. |
- Copyright (C) 2009-2012 Free Software Foundation, Inc. |
+ Copyright (C) 2009-2013 Free Software Foundation, Inc. |
This file is part of GDB. |
@@ -20,10 +20,11 @@ |
#include "server.h" |
#else |
#include "defs.h" |
-#include "gdb_string.h" |
+#include <string.h> |
#endif |
#include "linux-procfs.h" |
+#include "filestuff.h" |
/* Return the TGID of LWPID from /proc/pid/status. Returns -1 if not |
found. */ |
@@ -37,7 +38,7 @@ linux_proc_get_int (pid_t lwpid, const char *field) |
int retval = -1; |
snprintf (buf, sizeof (buf), "/proc/%d/status", (int) lwpid); |
- status_file = fopen (buf, "r"); |
+ status_file = gdb_fopen_cloexec (buf, "r"); |
if (status_file == NULL) |
{ |
warning (_("unable to open /proc file '%s'"), buf); |
@@ -83,7 +84,7 @@ linux_proc_pid_has_state (pid_t pid, const char *state) |
int have_state; |
xsnprintf (buffer, sizeof (buffer), "/proc/%d/status", (int) pid); |
- procfile = fopen (buffer, "r"); |
+ procfile = gdb_fopen_cloexec (buffer, "r"); |
if (procfile == NULL) |
{ |
warning (_("unable to open /proc file '%s'"), buffer); |