mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-01 21:06:06 -04:00
Check that /proc/self/fd exists before listing it
This commit is contained in:
parent
9e4dacd5e7
commit
709ba99afd
1 changed files with 4 additions and 0 deletions
|
@ -130,6 +130,10 @@ def _process_fds():
|
||||||
counts = {(k,): 0 for k in TYPES.values()}
|
counts = {(k,): 0 for k in TYPES.values()}
|
||||||
counts[("other",)] = 0
|
counts[("other",)] = 0
|
||||||
|
|
||||||
|
# Not every OS will have a /proc/self/fd directory
|
||||||
|
if not os.path.exists("/proc/self/fd"):
|
||||||
|
return counts
|
||||||
|
|
||||||
for fd in os.listdir("/proc/self/fd"):
|
for fd in os.listdir("/proc/self/fd"):
|
||||||
try:
|
try:
|
||||||
s = os.stat("/proc/self/fd/%s" % (fd))
|
s = os.stat("/proc/self/fd/%s" % (fd))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue