]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
run_cmd: close parent process console file descriptors
authorJason Dillaman <dillaman@redhat.com>
Tue, 27 Oct 2015 14:12:34 +0000 (10:12 -0400)
committerAbhishek Varshney <abhishek.varshney@flipkart.com>
Wed, 18 Nov 2015 08:16:47 +0000 (13:46 +0530)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit f46f7dc94139c0bafe10361622416d7dc343d31f)

src/common/run_cmd.cc

index 5f5cc3cca32355701481fbfba72e006dad3d49fc..81e41712b9b38b5a713c3ad345a9bd65a08ed8c5 100644 (file)
@@ -47,6 +47,9 @@ std::string run_cmd(const char *cmd, ...)
   }
   else if (fret == 0) {
     // execvp doesn't modify its arguments, so the const-cast here is safe.
+    close(STDIN_FILENO);
+    close(STDOUT_FILENO);
+    close(STDERR_FILENO);
     execvp(cmd, (char * const*)&arr[0]);
     _exit(127);
   }