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
5eeb357d
Commit
5eeb357d
authored
Feb 23, 2013
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1355 from phkelley/development
Portability fixes for Solaris
parents
68fec637
6c72035f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
11 deletions
+30
-11
src/errors.c
+4
-3
src/fileops.c
+26
-8
No files found.
src/errors.c
View file @
5eeb357d
...
@@ -89,15 +89,16 @@ void giterr_set_str(int error_class, const char *string)
...
@@ -89,15 +89,16 @@ void giterr_set_str(int error_class, const char *string)
int
giterr_set_regex
(
const
regex_t
*
regex
,
int
error_code
)
int
giterr_set_regex
(
const
regex_t
*
regex
,
int
error_code
)
{
{
char
error_buf
[
1024
];
char
error_buf
[
1024
];
assert
(
error_code
);
regerror
(
error_code
,
regex
,
error_buf
,
sizeof
(
error_buf
));
regerror
(
error_code
,
regex
,
error_buf
,
sizeof
(
error_buf
));
giterr_set_str
(
GITERR_REGEX
,
error_buf
);
giterr_set_str
(
GITERR_REGEX
,
error_buf
);
if
(
error_code
==
REG_NOMATCH
)
if
(
error_code
==
REG_NOMATCH
)
return
GIT_ENOTFOUND
;
return
GIT_ENOTFOUND
;
else
if
(
error_code
>
REG_BADPAT
)
return
GIT_EINVALIDSPEC
;
return
GIT_EINVALIDSPEC
;
else
return
-
1
;
}
}
void
giterr_clear
(
void
)
void
giterr_clear
(
void
)
...
...
src/fileops.c
View file @
5eeb357d
...
@@ -300,25 +300,43 @@ int git_futils_mkdir(
...
@@ -300,25 +300,43 @@ int git_futils_mkdir(
/* make directory */
/* make directory */
if
(
p_mkdir
(
make_path
.
ptr
,
mode
)
<
0
)
{
if
(
p_mkdir
(
make_path
.
ptr
,
mode
)
<
0
)
{
if
(
errno
==
EEXIST
)
{
int
already_exists
=
0
;
if
(
!
lastch
&&
(
flags
&
GIT_MKDIR_VERIFY_DIR
)
!=
0
)
{
if
(
!
git_path_isdir
(
make_path
.
ptr
))
{
switch
(
errno
)
{
case
EEXIST
:
if
(
!
lastch
&&
(
flags
&
GIT_MKDIR_VERIFY_DIR
)
!=
0
&&
!
git_path_isdir
(
make_path
.
ptr
))
{
giterr_set
(
giterr_set
(
GITERR_OS
,
"Existing path is not a directory '%s'"
,
GITERR_OS
,
"Existing path is not a directory '%s'"
,
make_path
.
ptr
);
make_path
.
ptr
);
error
=
GIT_ENOTFOUND
;
error
=
GIT_ENOTFOUND
;
goto
fail
;
goto
fail
;
}
}
already_exists
=
1
;
break
;
case
ENOSYS
:
/* Solaris can generate this error if you try to mkdir
* a path which is already a mount point. In that case,
* the path does already exist; but it's not implied by
* the definition of the error, so let's recheck */
if
(
git_path_isdir
(
make_path
.
ptr
))
{
already_exists
=
1
;
break
;
}
}
if
((
flags
&
GIT_MKDIR_EXCL
)
!=
0
)
{
giterr_set
(
GITERR_OS
,
"Directory already exists '%s'"
,
/* Fall through */
errno
=
ENOSYS
;
default:
giterr_set
(
GITERR_OS
,
"Failed to make directory '%s'"
,
make_path
.
ptr
);
make_path
.
ptr
);
error
=
GIT_EEXISTS
;
goto
fail
;
goto
fail
;
}
}
}
else
{
giterr_set
(
GITERR_OS
,
"Failed to make directory '%s'"
,
if
(
already_exists
&&
(
flags
&
GIT_MKDIR_EXCL
)
!=
0
)
{
giterr_set
(
GITERR_OS
,
"Directory already exists '%s'"
,
make_path
.
ptr
);
make_path
.
ptr
);
error
=
GIT_EEXISTS
;
goto
fail
;
goto
fail
;
}
}
}
}
...
...
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