summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2005-12-26 18:45:30 -0800
committerLibravatar Junio C Hamano <junkio@cox.net>2005-12-26 18:45:30 -0800
commit36de72aa9dc3b7daf8cf2770c840f39bb0d2ae70 (patch)
treeff61e0bd4d4454a4b34e920f80dbc1b4e427383d /diff.c
parentMerge branch 'jc/checkout' (diff)
parentGIT 1.0.5 (diff)
downloadtgif-36de72aa9dc3b7daf8cf2770c840f39bb0d2ae70.tar.xz
Merge fixes up to GIT 1.0.5
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/diff.c b/diff.c
index c8159183da..66057e5d61 100644
--- a/diff.c
+++ b/diff.c
@@ -504,9 +504,9 @@ static void prepare_temp_file(const char *name,
}
if (S_ISLNK(st.st_mode)) {
int ret;
- char *buf, buf_[1024];
- buf = ((sizeof(buf_) < st.st_size) ?
- xmalloc(st.st_size) : buf_);
+ char buf[PATH_MAX + 1]; /* ought to be SYMLINK_MAX */
+ if (sizeof(buf) <= st.st_size)
+ die("symlink too long: %s", name);
ret = readlink(name, buf, st.st_size);
if (ret < 0)
die("readlink(%s)", name);
@@ -650,7 +650,7 @@ static void diff_fill_sha1_info(struct diff_filespec *one)
if (DIFF_FILE_VALID(one)) {
if (!one->sha1_valid) {
struct stat st;
- if (stat(one->path, &st) < 0)
+ if (lstat(one->path, &st) < 0)
die("stat %s", one->path);
if (index_path(one->sha1, one->path, &st, 0))
die("cannot hash %s\n", one->path);