Commit f8c474099e137ca59909ff027a093d754d222f9a

Stefan Sperling 2020-10-28T15:52:46

fix permissions mode bits for fetched pack files; patch by Alisdair MacLeod

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/lib/fetch.c b/lib/fetch.c
index 3bdd5de..0e60b21 100644
--- a/lib/fetch.c
+++ b/lib/fetch.c
@@ -800,6 +800,15 @@ got_fetch_pack(struct got_object_id **pack_hash, struct got_pathlist_head *refs,
 	free(tmpidxpath);
 	tmpidxpath = NULL;
 
+	if (chmod(packpath, GOT_DEFAULT_FILE_MODE) != 0) {
+		err = got_error_from_errno2("chmod", packpath);
+		goto done;
+	}
+	if (chmod(idxpath, GOT_DEFAULT_FILE_MODE) != 0) {
+		err = got_error_from_errno2("chmod", idxpath);
+		goto done;
+	}
+
 done:
 	if (tmppackpath && unlink(tmppackpath) == -1 && err == NULL)
 		err = got_error_from_errno2("unlink", tmppackpath);