From: Zac Medico Date: Tue, 29 Nov 2011 03:09:10 +0000 (-0800) Subject: movefile: avoid redundant string concatenations X-Git-Tag: v2.2.0_alpha80~86 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9a353d3759f70043023eb36491ece0b9a8cdba6b;p=portage.git movefile: avoid redundant string concatenations --- diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py index 70ecb6010..c205fe934 100644 --- a/pym/portage/util/movefile.py +++ b/pym/portage/util/movefile.py @@ -169,15 +169,16 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None, if renamefailed: didcopy=0 if stat.S_ISREG(sstat[stat.ST_MODE]): + dest_tmp = dest + "#new" try: # For safety copy then move it over. if selinux_enabled: - selinux.copyfile(src, dest + "#new") - _copyxattr(src, dest + "#new") - selinux.rename(dest + "#new", dest) + selinux.copyfile(src, dest_tmp) + _copyxattr(src, dest_tmp) + selinux.rename(dest_tmp, dest) else: - shutil.copyfile(src, dest + "#new") - _copyxattr(src, dest + "#new") - os.rename(dest + "#new", dest) + shutil.copyfile(src, dest_tmp) + _copyxattr(src, dest_tmp) + os.rename(dest_tmp, dest) didcopy=1 except SystemExit as e: raise