diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2015-09-17 09:58:38 -0400 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2015-09-17 10:11:38 -0400 |
| commit | 0862ec2eb9529573ab46f3975defc0b7632bede4 (patch) | |
| tree | d210c87e64c7b1059d1b426945904dd655ae2a8b /src/path.c | |
| parent | 08df66301ec677f6cd98175a914dc933e2fb43a9 (diff) | |
| download | libgit2-0862ec2eb9529573ab46f3975defc0b7632bede4.tar.gz | |
core::mkdir tests: ensure we don't stomp symlinks in mkdir
In `mkdir` and `mkdir_r`, ensure that we don't try to remove symlinks
that are in our way.
Diffstat (limited to 'src/path.c')
| -rw-r--r-- | src/path.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/path.c b/src/path.c index cb11acee3..72cb289e0 100644 --- a/src/path.c +++ b/src/path.c @@ -526,6 +526,17 @@ bool git_path_isfile(const char *path) return S_ISREG(st.st_mode) != 0; } +bool git_path_islink(const char *path) +{ + struct stat st; + + assert(path); + if (p_lstat(path, &st) < 0) + return false; + + return S_ISLNK(st.st_mode) != 0; +} + #ifdef GIT_WIN32 bool git_path_is_empty_dir(const char *path) |
