From 9b981cecc6ca1791970bedece88165108c14879d Mon Sep 17 00:00:00 2001 From: "colynn.liu" Date: Fri, 22 Jan 2016 18:05:48 +0800 Subject: [PATCH] fixed python 2.4 compatibility nf=tempfile.NamedTemporaryFile(delete=False) TypeError: NamedTemporaryFile() got an unexpected keyword argument 'delete' --- system/pam_limits.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/system/pam_limits.py b/system/pam_limits.py index e14408fb4e2..1c56d852bbb 100644 --- a/system/pam_limits.py +++ b/system/pam_limits.py @@ -243,11 +243,16 @@ def main(): nf.write(new_limit) f.close() - nf.close() + nf.flush() # Copy tempfile to newfile module.atomic_move(nf.name, f.name) + try: + nf.close() + except: + pass + res_args = dict( changed = changed, msg = message )