Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2006-02-18 03:14:52 +0300
committerJunio C Hamano <junkio@cox.net>2006-02-18 03:20:51 +0300
commitb5b16990f8b074bd0481ced047b8f8bf66eee6dc (patch)
tree9cc8cdea7f77cfbf98f72e7e46e22e33e578f510
parenteedf8f97e58bbf4717705900379f2d63134047f9 (diff)
Prevent git-upload-pack segfault if object cannot be found
Signed-off-by: Carl Worth <cworth@cworth.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--sha1_file.c4
-rw-r--r--upload-pack.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 3d11a9bfdc..f08b1d6ee8 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -551,8 +551,10 @@ static void prepare_packed_git_one(char *objdir, int local)
sprintf(path, "%s/pack", objdir);
len = strlen(path);
dir = opendir(path);
- if (!dir)
+ if (!dir) {
+ fprintf(stderr, "unable to open object pack directory: %s: %s\n", path, strerror(errno));
return;
+ }
path[len++] = '/';
while ((de = readdir(dir)) != NULL) {
int namelen = strlen(de->d_name);
diff --git a/upload-pack.c b/upload-pack.c
index d1980556ca..3606529f61 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -216,6 +216,9 @@ static int send_ref(const char *refname, const unsigned char *sha1)
static char *capabilities = "multi_ack";
struct object *o = parse_object(sha1);
+ if (!o)
+ die("git-upload-pack: cannot find object %s:", sha1_to_hex(sha1));
+
if (capabilities)
packet_write(1, "%s %s%c%s\n", sha1_to_hex(sha1), refname,
0, capabilities);