mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Handle octal escaping in parsing /proc/mounts
This commit is contained in:
parent
08327a14ce
commit
af73248fab
@ -375,10 +375,14 @@ class Device(DeviceConfig, DevicePlugin):
|
|||||||
return drives
|
return drives
|
||||||
|
|
||||||
def node_mountpoint(self, node):
|
def node_mountpoint(self, node):
|
||||||
|
|
||||||
|
def de_octal(raw):
|
||||||
|
return re.sub(r'\\0\d+', lambda m: chr(int(m.group()[1:], 8)), raw)
|
||||||
|
|
||||||
for line in open('/proc/mounts').readlines():
|
for line in open('/proc/mounts').readlines():
|
||||||
line = line.split()
|
line = line.split()
|
||||||
if line[0] == node:
|
if line[0] == node:
|
||||||
return line[1]
|
return de_octal(line[1])
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def find_largest_partition(self, path):
|
def find_largest_partition(self, path):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user