Make sure that the user has write permissions when opening a temp file.
diff --git a/syscall.c b/syscall.c
index 0dfcaa0..4369c6e 100644
--- a/syscall.c
+++ b/syscall.c
@@ -211,6 +211,7 @@
 {
 	RETURN_ERROR_IF(dry_run, 0);
 	RETURN_ERROR_IF(read_only, EROFS);
+	perms |= S_IWUSR;
 
 #if defined HAVE_SECURE_MKSTEMP && defined HAVE_FCHMOD && (!defined HAVE_OPEN64 || defined HAVE_MKSTEMP64)
 	{