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
9c11bd0a
Commit
9c11bd0a
authored
Jun 17, 2011
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fileops: Fix 'GetFinalPathNameByHandleA' in old platforms
parent
cb75ffea
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletions
+17
-1
src/fileops.c
+17
-1
No files found.
src/fileops.c
View file @
9c11bd0a
...
...
@@ -689,9 +689,25 @@ int gitfo_lstat__w32(const char *file_name, struct stat *buf)
int
gitfo_readlink__w32
(
const
char
*
link
,
char
*
target
,
size_t
target_len
)
{
static
DWORD
(
*
pGetFinalPath
)(
HANDLE
,
LPTSTR
,
DWORD
,
DWORD
)
=
NULL
;
HANDLE
hFile
;
DWORD
dwRet
;
/*
* Try to load the pointer to pGetFinalPath dynamically, because
* it is not available in platforms older than Vista
*/
if
(
pGetFinalPath
==
NULL
)
{
HANDLE
library
=
LoadLibrary
(
"kernel32"
);
if
(
library
!=
NULL
)
pGetFinalPath
=
GetProcAddress
(
library
,
"GetFinalPathNameByHandleA"
);
if
(
pGetFinalPath
==
NULL
)
return
git__throw
(
GIT_EOSERR
,
"'GetFinalPathNameByHandleA' is not available in this platform"
);
}
hFile
=
CreateFile
(
link
,
// file to open
GENERIC_READ
,
// open for reading
FILE_SHARE_READ
,
// share for reading
...
...
@@ -703,7 +719,7 @@ int gitfo_readlink__w32(const char *link, char *target, size_t target_len)
if
(
hFile
==
INVALID_HANDLE_VALUE
)
return
GIT_EOSERR
;
dwRet
=
GetFinalPathNameByHandleA
(
hFile
,
target
,
target_len
,
VOLUME_NAME_DOS
);
dwRet
=
pGetFinalPath
(
hFile
,
target
,
target_len
,
VOLUME_NAME_DOS
);
if
(
dwRet
>=
target_len
)
return
GIT_ENOMEM
;
...
...
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