Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
72bfde97
Commit
72bfde97
authored
May 14, 2012
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #681 from scottjg/solaris-fixes
Fix build/runtime issues on Solaris
parents
27f5b7cf
212eb09d
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
54 additions
and
14 deletions
+54
-14
CMakeLists.txt
+3
-1
include/git2/common.h
+1
-1
src/compat/fnmatch.c
+0
-0
src/compat/fnmatch.h
+2
-2
src/fileops.c
+1
-1
src/path.c
+27
-6
src/unix/posix.h
+8
-2
src/win32/posix.h
+1
-1
tests-clar/core/dirent.c
+11
-0
No files found.
CMakeLists.txt
View file @
72bfde97
...
...
@@ -97,7 +97,9 @@ FILE(GLOB SRC_H include/git2/*.h)
# On Windows use specific platform sources
IF
(
WIN32 AND NOT CYGWIN
)
ADD_DEFINITIONS
(
-DWIN32 -D_DEBUG -D_WIN32_WINNT=0x0501
)
FILE
(
GLOB SRC src/*.c src/transports/*.c src/xdiff/*.c src/win32/*.c
)
FILE
(
GLOB SRC src/*.c src/transports/*.c src/xdiff/*.c src/win32/*.c src/compat/*.c
)
ELSEIF
(
CMAKE_SYSTEM_NAME MATCHES
"(Solaris|SunOS)"
)
FILE
(
GLOB SRC src/*.c src/transports/*.c src/xdiff/*.c src/unix/*.c src/compat/*.c
)
ELSE
()
FILE
(
GLOB SRC src/*.c src/transports/*.c src/xdiff/*.c src/unix/*.c
)
ENDIF
()
...
...
include/git2/common.h
View file @
72bfde97
...
...
@@ -77,7 +77,7 @@ GIT_BEGIN_DECL
#endif
/**
* The maximum length of a
git
valid git path.
* The maximum length of a valid git path.
*/
#define GIT_PATH_MAX 4096
...
...
src/
win32
/fnmatch.c
→
src/
compat
/fnmatch.c
View file @
72bfde97
File moved
src/
win32
/fnmatch.h
→
src/
compat
/fnmatch.h
View file @
72bfde97
...
...
@@ -4,8 +4,8 @@
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#ifndef INCLUDE_fnmatch__
w32
_h__
#define INCLUDE_fnmatch__
w32
_h__
#ifndef INCLUDE_fnmatch__
compat
_h__
#define INCLUDE_fnmatch__
compat
_h__
#include "common.h"
...
...
src/fileops.c
View file @
72bfde97
...
...
@@ -306,7 +306,7 @@ static int _rmdir_recurs_foreach(void *opaque, git_buf *path)
return
-
1
;
if
(
p_rmdir
(
path
->
ptr
)
<
0
)
{
if
(
removal_type
==
GIT_DIRREMOVAL_ONLY_EMPTY_DIRS
&&
errno
==
ENOTEMPTY
)
if
(
removal_type
==
GIT_DIRREMOVAL_ONLY_EMPTY_DIRS
&&
(
errno
==
ENOTEMPTY
||
errno
==
EEXIST
)
)
return
0
;
giterr_set
(
GITERR_OS
,
"Could not remove directory '%s'"
,
path
->
ptr
);
...
...
src/path.c
View file @
72bfde97
...
...
@@ -494,7 +494,7 @@ int git_path_direach(
{
ssize_t
wd_len
;
DIR
*
dir
;
struct
dirent
de_buf
,
*
de
;
struct
dirent
*
de
,
*
de_buf
;
if
(
git_path_to_dir
(
path
)
<
0
)
return
-
1
;
...
...
@@ -506,14 +506,23 @@ int git_path_direach(
return
-
1
;
}
while
(
p_readdir_r
(
dir
,
&
de_buf
,
&
de
)
==
0
&&
de
!=
NULL
)
{
#ifdef __sun
de_buf
=
git__malloc
(
sizeof
(
struct
dirent
)
+
FILENAME_MAX
+
1
);
#else
de_buf
=
git__malloc
(
sizeof
(
struct
dirent
));
#endif
while
(
p_readdir_r
(
dir
,
de_buf
,
&
de
)
==
0
&&
de
!=
NULL
)
{
int
result
;
if
(
is_dot_or_dotdot
(
de
->
d_name
))
continue
;
if
(
git_buf_puts
(
path
,
de
->
d_name
)
<
0
)
if
(
git_buf_puts
(
path
,
de
->
d_name
)
<
0
)
{
closedir
(
dir
);
git__free
(
de_buf
);
return
-
1
;
}
result
=
fn
(
arg
,
path
);
...
...
@@ -521,11 +530,13 @@ int git_path_direach(
if
(
result
<
0
)
{
closedir
(
dir
);
git__free
(
de_buf
);
return
-
1
;
}
}
closedir
(
dir
);
git__free
(
de_buf
);
return
0
;
}
...
...
@@ -537,7 +548,7 @@ int git_path_dirload(
{
int
error
,
need_slash
;
DIR
*
dir
;
struct
dirent
de_buf
,
*
de
;
struct
dirent
*
de
,
*
de_buf
;
size_t
path_len
;
assert
(
path
!=
NULL
&&
contents
!=
NULL
);
...
...
@@ -549,11 +560,17 @@ int git_path_dirload(
return
-
1
;
}
#ifdef __sun
de_buf
=
git__malloc
(
sizeof
(
struct
dirent
)
+
FILENAME_MAX
+
1
);
#else
de_buf
=
git__malloc
(
sizeof
(
struct
dirent
));
#endif
path
+=
prefix_len
;
path_len
-=
prefix_len
;
need_slash
=
(
path_len
>
0
&&
path
[
path_len
-
1
]
!=
'/'
)
?
1
:
0
;
while
((
error
=
p_readdir_r
(
dir
,
&
de_buf
,
&
de
))
==
0
&&
de
!=
NULL
)
{
while
((
error
=
p_readdir_r
(
dir
,
de_buf
,
&
de
))
==
0
&&
de
!=
NULL
)
{
char
*
entry_path
;
size_t
entry_len
;
...
...
@@ -573,11 +590,15 @@ int git_path_dirload(
memcpy
(
&
entry_path
[
path_len
+
need_slash
],
de
->
d_name
,
entry_len
);
entry_path
[
path_len
+
need_slash
+
entry_len
]
=
'\0'
;
if
(
git_vector_insert
(
contents
,
entry_path
)
<
0
)
if
(
git_vector_insert
(
contents
,
entry_path
)
<
0
)
{
closedir
(
dir
);
git__free
(
de_buf
);
return
-
1
;
}
}
closedir
(
dir
);
git__free
(
de_buf
);
if
(
error
!=
0
)
giterr_set
(
GITERR_OS
,
"Failed to process directory entry in '%s'"
,
path
);
...
...
src/unix/posix.h
View file @
72bfde97
...
...
@@ -7,7 +7,14 @@
#ifndef INCLUDE_posix__w32_h__
#define INCLUDE_posix__w32_h__
#include <fnmatch.h>
#ifndef __sun
# include <fnmatch.h>
# define p_fnmatch(p, s, f) fnmatch(p, s, f)
#else
# include "compat/fnmatch.h"
#endif
#include <stdio.h>
#define p_lstat(p,b) lstat(p,b)
#define p_readlink(a, b, c) readlink(a, b, c)
...
...
@@ -16,7 +23,6 @@
#define p_mkdir(p,m) mkdir(p, m)
#define p_fsync(fd) fsync(fd)
#define p_realpath(p, po) realpath(p, po)
#define p_fnmatch(p, s, f) fnmatch(p, s, f)
#define p_vsnprintf(b, c, f, a) vsnprintf(b, c, f, a)
#define p_snprintf(b, c, f, ...) snprintf(b, c, f, __VA_ARGS__)
#define p_mkstemp(p) mkstemp(p)
...
...
src/win32/posix.h
View file @
72bfde97
...
...
@@ -8,7 +8,7 @@
#define INCLUDE_posix__w32_h__
#include "common.h"
#include "fnmatch.h"
#include "
compat/
fnmatch.h"
#include "utf-conv.h"
GIT_INLINE
(
int
)
p_link
(
const
char
*
old
,
const
char
*
new
)
...
...
tests-clar/core/dirent.c
View file @
72bfde97
...
...
@@ -222,3 +222,14 @@ void test_core_dirent__traverse_weird_filenames(void)
check_counts
(
&
odd
);
}
/* test filename length limits */
void
test_core_dirent__length_limits
(
void
)
{
char
*
big_filename
=
(
char
*
)
git__malloc
(
FILENAME_MAX
+
1
);
memset
(
big_filename
,
'a'
,
FILENAME_MAX
+
1
);
big_filename
[
FILENAME_MAX
]
=
0
;
cl_must_fail
(
p_creat
(
big_filename
,
0666
));
git__free
(
big_filename
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment