Lines 46-58
def linux_ro_checker(dir_list):
Link Here
|
46 |
ro_filesystems = set() |
46 |
ro_filesystems = set() |
47 |
|
47 |
|
48 |
try: |
48 |
try: |
|
|
49 |
roregex = re.compile(r'(\A|,)ro(\Z|,)') |
49 |
with io.open("/proc/mounts", mode='r', encoding=_encodings['content'], |
50 |
with io.open("/proc/mounts", mode='r', encoding=_encodings['content'], |
50 |
errors='replace') as f: |
51 |
errors='replace') as f: |
51 |
roregex = re.compile(r'(\A|,)ro(\Z|,)') |
52 |
lines = [s.replace('\n', '') for s in f.readlines()] |
52 |
for line in f: |
53 |
for line in lines.reverse(): |
53 |
if roregex.search(line.split(" ")[3].strip()) is not None: |
54 |
if roregex.search(line.split(" ")[3].strip()) is not None: |
54 |
romount = line.split(" ")[1].strip() |
55 |
romount = line.split(" ")[1].strip() |
55 |
ro_filesystems.add(romount) |
56 |
ro_filesystems.add(romount) |
56 |
|
57 |
|
57 |
# If /proc/mounts can't be read, assume that there are no RO |
58 |
# If /proc/mounts can't be read, assume that there are no RO |
58 |
# filesystems and return. |
59 |
# filesystems and return. |
59 |
- |
|
|