]> sourceware.org Git - systemtap.git/commitdiff
PR14245 stapio should not pass inherited relay_basedir_fd
authorFrank Ch. Eigler <fche@redhat.com>
Fri, 12 Oct 2012 03:31:28 +0000 (23:31 -0400)
committerFrank Ch. Eigler <fche@redhat.com>
Fri, 12 Oct 2012 03:31:28 +0000 (23:31 -0400)
jistone reported that new fd passing should be suppressed for stapio-spawned
child processes like target_cmd or function::system().

* staprun/stapio.c (main): Set CLOEXEC on relay_basedir_fd (if any).

staprun/stapio.c

index 63556e43906b46f8c42f35fbc661f6b4a99fd157..e8daf0e3db7a030c61b3496349978f0bfa04e1e6 100644 (file)
@@ -15,7 +15,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
- * Copyright (C) 2005-2007 Red Hat, Inc.
+ * Copyright (C) 2005-2012 Red Hat, Inc.
  *
  */
 
@@ -33,6 +33,15 @@ int main(int argc, char **argv)
        setup_signals();
        parse_args(argc, argv);
 
+        /* If we inherited a relay_basedir_fd, we want to keep it to ourselves -
+           i.e., FD_CLOEXEC the bad boy. */
+        if (relay_basedir_fd >= 0) {
+                int rc =  set_clexec(relay_basedir_fd);
+                if (rc) 
+                        exit(-1);
+        }
+
+
        if (buffer_size)
                dbug(1, "Using a buffer of %u MB.\n", buffer_size);
 
This page took 0.030369 seconds and 5 git commands to generate.