mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-21 20:14:44 +00:00
Fix windows specific issues
- msvc compilation warnings - not released file handle that prevents file removal
This commit is contained in:
parent
0ffcf78a30
commit
1ee5fd903d
@ -305,6 +305,8 @@ static int _rmdir_recurs_cb(void *GIT_UNUSED(nil), char *path)
|
|||||||
{
|
{
|
||||||
int error = GIT_SUCCESS;
|
int error = GIT_SUCCESS;
|
||||||
|
|
||||||
|
GIT_UNUSED_ARG(nil)
|
||||||
|
|
||||||
error = git_futils_isdir(path);
|
error = git_futils_isdir(path);
|
||||||
if (error == GIT_SUCCESS) {
|
if (error == GIT_SUCCESS) {
|
||||||
size_t root_size = strlen(path);
|
size_t root_size = strlen(path);
|
||||||
|
@ -106,7 +106,7 @@ extern git_off_t git_futils_filesize(git_file fd);
|
|||||||
extern int git_futils_rmdir_recurs(const char *path);
|
extern int git_futils_rmdir_recurs(const char *path);
|
||||||
|
|
||||||
/* Taken from git.git */
|
/* Taken from git.git */
|
||||||
static inline int is_dot_or_dotdot(const char *name)
|
GIT_INLINE(int) is_dot_or_dotdot(const char *name)
|
||||||
{
|
{
|
||||||
return (name[0] == '.' &&
|
return (name[0] == '.' &&
|
||||||
(name[1] == '\0' ||
|
(name[1] == '\0' ||
|
||||||
|
@ -513,13 +513,14 @@ END_TEST
|
|||||||
|
|
||||||
BEGIN_TEST(rmdir1, "make sure non-empty dir cannot be deleted recusively")
|
BEGIN_TEST(rmdir1, "make sure non-empty dir cannot be deleted recusively")
|
||||||
char file[GIT_PATH_MAX];
|
char file[GIT_PATH_MAX];
|
||||||
|
int fd;
|
||||||
|
|
||||||
must_pass(setup_empty_tmp_dir());
|
must_pass(setup_empty_tmp_dir());
|
||||||
git_path_join(file, empty_tmp_dir, "/two/file.txt");
|
git_path_join(file, empty_tmp_dir, "/two/file.txt");
|
||||||
must_pass(fd = p_creat(file, 0755));
|
fd = p_creat(file, 0755);
|
||||||
must_pass(fd);
|
must_pass(fd);
|
||||||
must_fail(git_futils_rmdir_recurs(empty_tmp_dir));
|
|
||||||
must_pass(p_close(fd));
|
must_pass(p_close(fd));
|
||||||
|
must_fail(git_futils_rmdir_recurs(empty_tmp_dir));
|
||||||
must_pass(p_unlink(file));
|
must_pass(p_unlink(file));
|
||||||
must_pass(git_futils_rmdir_recurs(empty_tmp_dir));
|
must_pass(git_futils_rmdir_recurs(empty_tmp_dir));
|
||||||
END_TEST
|
END_TEST
|
||||||
|
Loading…
Reference in New Issue
Block a user