summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: de809db)
raw | patch | inline | side by side (parent: de809db)
author | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Fri, 20 May 2005 14:49:17 +0000 (07:49 -0700) | ||
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Fri, 20 May 2005 14:49:17 +0000 (07:49 -0700) |
Noted by Frank Sorenson and Petr Baudis, patch rewritten by me.
fsck-cache.c | patch | blob | history |
diff --git a/fsck-cache.c b/fsck-cache.c
index 32fa5d53e54f253720c165c6b3a5a6e1c4a44f9a..6c65f2bb2262f378e17fc75600a32abeaf4e1ed6 100644 (file)
--- a/fsck-cache.c
+++ b/fsck-cache.c
return 0;
}
-static void read_sha1_reference(const char *path)
+static int read_sha1_reference(const char *path)
{
char hexname[60];
unsigned char sha1[20];
struct object *obj;
if (fd < 0)
- return;
+ return -1;
len = read(fd, hexname, sizeof(hexname));
close(fd);
if (len < 40)
- return;
+ return -1;
if (get_sha1_hex(hexname, sha1) < 0)
- return;
+ return -1;
obj = lookup_object(sha1);
+ if (!obj)
+ return error("%s: invalid sha1 pointer %.40s", path, hexname);
+
obj->used = 1;
mark_reachable(obj, REACHABLE);
+ return 0;
}
static void find_file_objects(const char *base, const char *name)