Ceph backup: set close_fds on Popen

Open file descriptors should not be passed
to the child processes.

This only affects Python 2, Python 3.2+ defaults
to this value being True.

Change-Id: I5c9bb0c04a4aafae8815667f56be4dee07c4aab7
This commit is contained in:
Eric Harney
2018-04-10 10:14:44 -04:00
parent 70a809dd21
commit a780ea60ee

View File

@@ -545,7 +545,8 @@ class CephBackupDriver(driver.BackupDriver):
try:
p1 = subprocess.Popen(cmd1, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stderr=subprocess.PIPE,
close_fds=True)
except OSError as e:
LOG.error("Pipe1 failed - %s ", e)
raise
@@ -559,7 +560,8 @@ class CephBackupDriver(driver.BackupDriver):
try:
p2 = subprocess.Popen(cmd2, stdin=p1.stdout,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stderr=subprocess.PIPE,
close_fds=True)
except OSError as e:
LOG.error("Pipe2 failed - %s ", e)
raise