updated for version 7.0061
diff --git a/src/fileio.c b/src/fileio.c
index 4e5104a..a5e888a 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3701,7 +3701,7 @@
     while ((fd = mch_open((char *)wfname, O_WRONLY | O_EXTRA | (append
 			? (forceit ? (O_APPEND | O_CREAT) : O_APPEND)
 			: (O_CREAT | O_TRUNC))
-			, perm & 0777)) < 0)
+			, perm < 0 ? 0666 : (perm & 0777))) < 0)
     {
 	/*
 	 * A forced write will try to create a new file if the old one is
@@ -4269,7 +4269,7 @@
 
 	    if (org == NULL
 		    || (empty_fd = mch_open(org, O_CREAT | O_EXTRA | O_EXCL,
-							    perm & 0777)) < 0)
+					perm < 0 ? 0666 : (perm & 0777))) < 0)
 	      EMSG(_("E206: patchmode: can't touch empty original file"));
 	    else
 	      close(empty_fd);