summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5a688fe)
raw | patch | inline | side by side (parent: 5a688fe)
author | Johan Herland <johan@herland.net> | |
Thu, 26 Mar 2009 15:16:47 +0000 (16:16 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 28 Mar 2009 05:10:58 +0000 (22:10 -0700) |
When writing out a loose object or a pack (index), move_temp_to_file() is
called to finalize the resulting file. These files (loose files and packs)
should all have permission mode 0444 (modulo adjust_shared_perm()).
Therefore, instead of doing chmod(foo, 0444) explicitly from each callsite
(or even forgetting to chmod() at all), do the chmod() call from within
move_temp_to_file().
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
called to finalize the resulting file. These files (loose files and packs)
should all have permission mode 0444 (modulo adjust_shared_perm()).
Therefore, instead of doing chmod(foo, 0444) explicitly from each callsite
(or even forgetting to chmod() at all), do the chmod() call from within
move_temp_to_file().
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
fast-import.c | patch | blob | history | |
http-push.c | patch | blob | history | |
http-walker.c | patch | blob | history | |
index-pack.c | patch | blob | history | |
sha1_file.c | patch | blob | history |
diff --git a/fast-import.c b/fast-import.c
index 3748ddf48d9bdeea890af805016b69e76493a79d..d5fc042bbfe97080df3e275f069055c63bad32eb 100644 (file)
--- a/fast-import.c
+++ b/fast-import.c
static const char *keep_msg = "fast-import";
int keep_fd;
- chmod(pack_data->pack_name, 0444);
- chmod(curr_index_name, 0444);
-
keep_fd = odb_pack_keep(name, sizeof(name), pack_data->sha1);
if (keep_fd < 0)
die("cannot create keep file");
diff --git a/http-push.c b/http-push.c
index 30d2d340418f7f40b77823b1b58b307985347bdf..968b6b0662a89d437e53bcc699c65e98a745f659 100644 (file)
--- a/http-push.c
+++ b/http-push.c
aborted = 1;
}
} else if (request->state == RUN_FETCH_LOOSE) {
- fchmod(request->local_fileno, 0444);
close(request->local_fileno); request->local_fileno = -1;
if (request->curl_result != CURLE_OK &&
diff --git a/http-walker.c b/http-walker.c
index 0dbad3c888c6c9441af4d9550fd147ecb5b1aaf3..c5a3ea3b31045be9407579a9d1aba222ee3e9914 100644 (file)
--- a/http-walker.c
+++ b/http-walker.c
{
struct stat st;
- fchmod(obj_req->local, 0444);
close(obj_req->local); obj_req->local = -1;
if (obj_req->http_code == 416) {
diff --git a/index-pack.c b/index-pack.c
index 7fee8725333860dbbd13d8de5ae7baf1ef33976d..5dfe03ee6cbbf531a5db053fc8f8fd41b0a59aab 100644 (file)
--- a/index-pack.c
+++ b/index-pack.c
}
if (move_temp_to_file(curr_pack_name, final_pack_name))
die("cannot store pack file");
- }
- if (from_stdin)
+ } else if (from_stdin)
chmod(final_pack_name, 0444);
if (final_index_name != curr_index_name) {
}
if (move_temp_to_file(curr_index_name, final_index_name))
die("cannot store index file");
- }
- chmod(final_index_name, 0444);
+ } else
+ chmod(final_index_name, 0444);
if (!from_stdin) {
printf("%s\n", sha1_to_hex(sha1));
diff --git a/sha1_file.c b/sha1_file.c
index 45987bdea8aadba897338e106b208b7c09558065..3bd20e715b785ab315e734c4ad5a18611e16cdf5 100644 (file)
--- a/sha1_file.c
+++ b/sha1_file.c
/* FIXME!!! Collision check here ? */
}
- if (adjust_shared_perm(filename))
+ if (chmod(filename, 0444) || adjust_shared_perm(filename))
return error("unable to set permission to '%s'", filename);
return 0;
}
{
if (fsync_object_files)
fsync_or_die(fd, "sha1 file");
- fchmod(fd, 0444);
if (close(fd) != 0)
die("error when closing sha1 file (%s)", strerror(errno));
}