diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2016-02-28 00:46:52 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2016-02-28 00:46:52 +0100 |
commit | 2449beb7e6c671e20d34bfebcaadaf34180b4b31 (patch) | |
tree | 33e723ab5f27c7a7e096a5760b8d092e8d8b2ce3 | |
parent | 6d106928cb66ddf7c2b649eec00ee3f55639364a (diff) | |
download | psutil-2449beb7e6c671e20d34bfebcaadaf34180b4b31.tar.gz |
minor refactoring777-linux-files-pos-mode
-rw-r--r-- | psutil/_pslinux.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py index 74b6cad6..324ff5cb 100644 --- a/psutil/_pslinux.py +++ b/psutil/_pslinux.py @@ -1325,17 +1325,14 @@ class Process(object): # A regular file is always supposed to be have an # absolute path though. if path.startswith('/') and isfile_strict(path): - # Get file position. + # Get file position and flags. file = "%s/%s/fdinfo/%s" % ( self._procfs_path, self.pid, fd) with open_binary(file) as f: - pos = f.readline().split()[1] - flags = f.readline().split()[1] - # flags is an octal number - flags_oct = int(flags, 8) - mode = file_flags_to_mode(flags_oct) - ntuple = popenfile( - path, int(fd), int(pos), mode, flags_oct) + pos = int(f.readline().split()[1]) + flags = int(f.readline().split()[1], 8) + mode = file_flags_to_mode(flags) + ntuple = popenfile(path, int(fd), int(pos), mode, flags) retlist.append(ntuple) if hit_enoent: # raise NSP if the process disappeared on us |