summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-08-01 14:30:08 -0700
committerRussell Belfer <rb@github.com>2012-08-22 16:07:19 -0700
commit0e26202cd587f45edc96966ed327e93354e2102e (patch)
treed18688a8137313bc548d67fda23d498f73b383dc
parentca1b6e54095a7e28d468a832f143025feae6cd4f (diff)
downloadlibgit2-0e26202cd587f45edc96966ed327e93354e2102e.tar.gz
fix missing validation and type cast warning
-rw-r--r--src/fileops.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/fileops.c b/src/fileops.c
index 5aa6632e0..ceded4338 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -264,6 +264,8 @@ int git_futils_mkdir(
/* clip root to make_path length */
if (root >= (ssize_t)make_path.size)
root = (ssize_t)make_path.size - 1;
+ if (root < 0)
+ root = 0;
tail = & make_path.ptr[root];
@@ -666,7 +668,8 @@ static int _cp_r_callback(void *ref, git_buf *from)
/* make symlink or regular file */
if (S_ISLNK(from_st.st_mode))
- return git_futils_cplink(from->ptr, from_st.st_size, info->to.ptr);
+ return git_futils_cplink(
+ from->ptr, (size_t)from_st.st_size, info->to.ptr);
else
return git_futils_cp_withpath(
from->ptr, info->to.ptr, from_st.st_mode, info->dirmode);