diff options
author | VG <vg@devys.org> | 2016-12-09 14:46:44 +0100 |
---|---|---|
committer | VG <vg@devys.org> | 2016-12-09 14:46:44 +0100 |
commit | 7e666933b3407f5cdf7c6f3f50793d8eb2a6ba78 (patch) | |
tree | 84409bcda7fa02013b632c72b8a9e43f92a709ff | |
parent | eb5f48d46ebb6fa14c831e1c20335b51b9296627 (diff) | |
download | clip-7e666933b3407f5cdf7c6f3f50793d8eb2a6ba78.tar.gz clip-7e666933b3407f5cdf7c6f3f50793d8eb2a6ba78.tar.bz2 clip-7e666933b3407f5cdf7c6f3f50793d8eb2a6ba78.zip |
simplify write mode detection and replace
-rwxr-xr-x | clip | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -40,9 +40,7 @@ def fileno(filelike): def secure_open(path, mode='r', *l, **kw): if os.path.islink(path): raise SecurityError("The clipboard file can not be a symlink") - real_mode = mode - if 'w' in real_mode: - real_mode = real_mode.replace('w', 'a') + real_mode = real_mode.replace('w', 'a') with open(path, real_mode, *l, **kw) as fo: if os.fstat(fileno(fo)) != os.stat(path): raise SecurityError("Intrusion might have been done on %s" % path) |