PR server/15604
authorJan Kratochvil <jan.kratochvil@redhat.com>
Wed, 28 Aug 2013 17:40:58 +0000 (17:40 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Wed, 28 Aug 2013 17:40:58 +0000 (17:40 +0000)
gdb/gdbserver/
2013-08-28  Jan Kratochvil  <jan.kratochvil@redhat.com>

PR server/15604
* linux-low.c: Include filestuff.h.
(linux_create_inferior) <pid == 0>: Call close_most_fds.
* lynx-low.c: Include filestuff.h.
(lynx_create_inferior) <pid == 0>: Call close_most_fds.
* server.c: Include filestuff.h.
(main): Call notice_open_fds.
* spu-low.c: Include filestuff.h.
(spu_create_inferior) <pid == 0>: Call close_most_fds.

gdb/gdbserver/ChangeLog
gdb/gdbserver/linux-low.c
gdb/gdbserver/lynx-low.c
gdb/gdbserver/server.c
gdb/gdbserver/spu-low.c

index fe3660c020dc2bda6892724fd9a98d969bb9493c..913fe42c45fe98e60aefd95d9d4805b3da23153b 100644 (file)
@@ -1,3 +1,15 @@
+2013-08-28  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       PR server/15604
+       * linux-low.c: Include filestuff.h.
+       (linux_create_inferior) <pid == 0>: Call close_most_fds.
+       * lynx-low.c: Include filestuff.h.
+       (lynx_create_inferior) <pid == 0>: Call close_most_fds.
+       * server.c: Include filestuff.h.
+       (main): Call notice_open_fds.
+       * spu-low.c: Include filestuff.h.
+       (spu_create_inferior) <pid == 0>: Call close_most_fds.
+
 2013-08-22  Luis Machado  <lgustavo@codesourcery.com>
 
        * Makefile.in: Explain why ../target and ../nat are not
index 12208dcc1e11752d8b63d4dfccc572c06252015b..7db1fc8e9479d62888a42a62762b194f2efd9e35 100644 (file)
@@ -44,6 +44,7 @@
 #include "gdb_stat.h"
 #include <sys/vfs.h>
 #include <sys/uio.h>
+#include "filestuff.h"
 #ifndef ELFMAG0
 /* Don't include <linux/elf.h> here.  If it got included by gdb_proc_service.h
    then ELFMAG0 will have been defined.  If it didn't get included by
@@ -580,6 +581,7 @@ linux_create_inferior (char *program, char **allargs)
 
   if (pid == 0)
     {
+      close_most_fds ();
       ptrace (PTRACE_TRACEME, 0, (PTRACE_TYPE_ARG3) 0, (PTRACE_TYPE_ARG4) 0);
 
 #ifndef __ANDROID__ /* Bionic doesn't use SIGRTMIN the way glibc does.  */
index 4cf86837f3fb43574778e526e4c765a473273c93..3c75b6296b8f4134c6363d73da3c48a3b08d99ee 100644 (file)
@@ -27,6 +27,7 @@
 #include <sys/types.h>
 #include "gdb_wait.h"
 #include <signal.h>
+#include "filestuff.h"
 
 int using_threads = 1;
 
@@ -240,6 +241,8 @@ lynx_create_inferior (char *program, char **allargs)
     {
       int pgrp;
 
+      close_most_fds ();
+
       /* Switch child to its own process group so that signals won't
          directly affect gdbserver. */
       pgrp = getpid();
index a4b9129bbfd0e2866b78f039eeaf6e831e65e3eb..ebdaba504673e05b073b083977a26bb1211a720c 100644 (file)
@@ -28,6 +28,7 @@
 #endif
 #include "gdb_wait.h"
 #include "btrace-common.h"
+#include "filestuff.h"
 
 /* The thread set with an `Hc' packet.  `Hc' is deprecated in favor of
    `vCont'.  Note the multi-process extensions made `vCont' a
@@ -2850,6 +2851,10 @@ main (int argc, char *argv[])
       exit (1);
     }
 
+  /* Remember stdio descriptors.  LISTEN_DESC must not be listed, it will be
+     opened by remote_prepare.  */
+  notice_open_fds ();
+
   /* We need to know whether the remote connection is stdio before
      starting the inferior.  Inferiors created in this scenario have
      stdin,stdout redirected.  So do this here before we call
index 6e3974a45462e92f70ee50c4eb80f6e2e1df6a02..e604b9f62bfdcc894d3433df3f4c916a3d34c60b 100644 (file)
@@ -29,6 +29,7 @@
 #include <unistd.h>
 #include <errno.h>
 #include <sys/syscall.h>
+#include "filestuff.h"
 
 /* Some older glibc versions do not define this.  */
 #ifndef __WNOTHREAD
@@ -274,6 +275,7 @@ spu_create_inferior (char *program, char **allargs)
 
   if (pid == 0)
     {
+      close_most_fds ();
       ptrace (PTRACE_TRACEME, 0, 0, 0);
 
       setpgid (0, 0);
This page took 0.036095 seconds and 4 git commands to generate.