[PATCH] unpack-objects: Fix EACCES pushing to remote on vmhgfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Creating files with 0444 mode causes EACCES opening them for writing
in some setups where the creating user does not automatically have
write access.
E.g. on a vmhgfs (VMWare shared folders) with Windows host, this causes
the file on the host to be created with the read-only attribute set
which prohibits writing for everyone.

Change the mode to 0644, explicitly signaling we want write access.

Signed-off-by: Ivan Pozdeev <vano@xxxxxxxxxxxx>
---
 object-file.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/object-file.c b/object-file.c
index 610b1f465c..bc71106ea8 100644
--- a/object-file.c
+++ b/object-file.c
@@ -2002,7 +2002,7 @@ static int create_tmpfile(struct strbuf *tmp, const char *filename)
 	strbuf_reset(tmp);
 	strbuf_add(tmp, filename, dirlen);
 	strbuf_addstr(tmp, "tmp_obj_XXXXXX");
-	fd = git_mkstemp_mode(tmp->buf, 0444);
+	fd = git_mkstemp_mode(tmp->buf, 0644);
 	if (fd < 0 && dirlen && errno == ENOENT) {
 		/*
 		 * Make sure the directory exists; note that the contents
@@ -2019,7 +2019,7 @@ static int create_tmpfile(struct strbuf *tmp, const char *filename)
 
 		/* Try again */
 		strbuf_addstr(tmp, "/tmp_obj_XXXXXX");
-		fd = git_mkstemp_mode(tmp->buf, 0444);
+		fd = git_mkstemp_mode(tmp->buf, 0644);
 	}
 	return fd;
 }
-- 
2.36.1.windows.1





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux