diff options
author | Junio C Hamano <junkio@cox.net> | 2005-12-26 18:44:15 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2005-12-26 18:44:15 -0800 |
commit | e5f5219a4f1faf3b4e1816fad3a6296a1d39b878 (patch) | |
tree | e41c6fb839732b2fe45bd9416a22411ed3035a07 /diff.c | |
parent | GIT 1.0.4 (diff) | |
parent | Handle symlinks graciously (diff) | |
download | tgif-e5f5219a4f1faf3b4e1816fad3a6296a1d39b878.tar.xz |
GIT 1.0.5
Minor fixes.
Starting from this one I won't be touching debian/ directory
since the official maintainer seems to be reasonably quick to
package up things. The packaging procedure used there seems to
be quite different from what I have, so I'd like to avoid
potential confusion and reduce work by the official maintainer
and myself.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'diff.c')
-rw-r--r-- | diff.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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); |