kiss: ensure move only occurs when copy fails

This commit is contained in:
Dylan Araps 2021-07-14 11:33:41 +03:00
parent e671914090
commit 7e2a79a7fa
No known key found for this signature in database
GPG Key ID: 13295DAC2CF13B5C
1 changed files with 2 additions and 2 deletions

4
kiss
View File

@ -1117,14 +1117,14 @@ pkg_install_files() {
# Copy the file to the destination directory with the
# temporary name created above.
cp -fP "$2$file" "$__tmp"
cp -fP "$2$file" "$__tmp" &&
# Atomically move the temporary file to its final
# destination. The running processes will either get
# the old file or the new one.
mv -f "$__tmp" "$_file"
fi
esac
esac || return 1
done
}