Skip to content
This repository was archived by the owner on Dec 9, 2022. It is now read-only.

Commit eaccf4c

Browse files
committed
plugins: Use subprocess.check_output() with a sequence of program arguments
All subprocess.get*output() should be replaced with either subprocess.Popen or subprocess.check_output now. String args were converted to sequences of program arguments.
1 parent dda55aa commit eaccf4c

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Diff for: plugins/src/allow_execstack.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@
2323
from setroubleshoot.util import *
2424
from setroubleshoot.Plugin import Plugin
2525

26-
import commands
26+
import subprocess
2727
import sys
2828

2929
def is_execstack(path):
3030
if path[0] != "/":
3131
return False
3232

33-
x = commands.getoutput("execstack -q %s" % path).split()
34-
return ( x[0] == "X" )
33+
x = subprocess.check_output(["execstack", "-q", path], universal_newlines=True).split()
34+
return ( x[0] == "X" )
3535

3636
def find_execstack(exe, pid):
3737
execstacklist = []
38-
for path in commands.getoutput("ldd %s" % exe).split():
38+
for path in subprocess.check_output(["ldd", exe], universal_newlines=True).split():
3939
if is_execstack(path) and path not in execstacklist:
4040
execstacklist.append(path)
4141
try:

Diff for: plugins/src/findexecstack

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
#! /usr/bin/python
2-
import commands
2+
import subprocess
33
import sys
44

55
def is_execstack(path):
66
if path[0] != "/":
77
return False
88

9-
x = commands.getoutput("execstack -q %s" % path).split()
9+
x = subprocess.check_output(["execstack", "-q", path], universal_newlines=True).split()
1010
return ( x[0] == "X" )
1111

1212
def find_execstack(exe, pid):
1313
execstacklist = []
14-
for path in commands.getoutput("ldd %s" % sys.argv[1]).split():
14+
for path in subprocess.check_output(["ldd", sys.argv[1]], universal_newlines=True).split():
1515
if is_execstack(path) and path not in execstacklist:
1616
execstacklist.append(path)
1717
try:

0 commit comments

Comments
 (0)