Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
48ca8388
Commit
48ca8388
authored
Jan 31, 2006
by
Michael Jung
Committed by
Alexandre Julliard
Jan 31, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unixfs: Only resolve the 'dosdevices' based symbol links in
UNIXFS_get_unix_path, but leave all others alone.
parent
eb893bde
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
64 deletions
+24
-64
shfldr_unixfs.c
dlls/shell32/shfldr_unixfs.c
+24
-64
No files found.
dlls/shell32/shfldr_unixfs.c
View file @
48ca8388
...
...
@@ -129,6 +129,7 @@
#include <stdarg.h>
#include <limits.h>
#include <dirent.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
...
...
@@ -403,8 +404,8 @@ static BOOL UNIXFS_is_dos_device(const struct stat *statPath) {
/******************************************************************************
* UNIXFS_get_unix_path [Internal]
*
* Convert an absolute dos path to an absolute
canonicalized
unix path.
* Evaluate "/.", "/.." and
symbolic link
s.
* Convert an absolute dos path to an absolute unix path.
* Evaluate "/.", "/.." and
the symbolic links in $WINEPREFIX/dosdevice
s.
*
* PARAMS
* pszDosPath [I] An absolute dos path
...
...
@@ -417,18 +418,32 @@ static BOOL UNIXFS_is_dos_device(const struct stat *statPath) {
static
BOOL
UNIXFS_get_unix_path
(
LPCWSTR
pszDosPath
,
char
*
pszCanonicalPath
)
{
char
*
pPathTail
,
*
pElement
,
*
pCanonicalTail
,
szPath
[
FILENAME_MAX
],
*
pszUnixPath
;
struct
stat
fileStat
;
WCHAR
wszDrive
[]
=
{
'?'
,
':'
,
'\\'
,
0
};
int
cDriveSymlinkLen
;
TRACE
(
"(pszDosPath=%s, pszCanonicalPath=%p)
\n
"
,
debugstr_w
(
pszDosPath
),
pszCanonicalPath
);
if
(
!
pszDosPath
||
pszDosPath
[
1
]
!=
':'
)
return
FALSE
;
/* Get the canonicalized unix path corresponding to the drive letter. */
wszDrive
[
0
]
=
pszDosPath
[
0
];
pszUnixPath
=
wine_get_unix_file_name
(
wszDrive
);
if
(
!
pszUnixPath
)
return
FALSE
;
cDriveSymlinkLen
=
strlen
(
pszUnixPath
);
pElement
=
canonicalize_file_name
(
pszUnixPath
);
HeapFree
(
GetProcessHeap
(),
0
,
pszUnixPath
);
if
(
!
pElement
)
return
FALSE
;
strcpy
(
szPath
,
pElement
);
strcat
(
szPath
,
"/"
);
free
(
pElement
);
/* Append the part relative to the drive symbolic link target. */
pszUnixPath
=
wine_get_unix_file_name
(
pszDosPath
);
if
(
!
pszUnixPath
)
return
FALSE
;
strc
py
(
szPath
,
pszUnixPath
);
if
(
!
pszUnixPath
)
return
FALSE
;
strc
at
(
szPath
,
pszUnixPath
+
cDriveSymlinkLen
);
HeapFree
(
GetProcessHeap
(),
0
,
pszUnixPath
);
/* pCanonicalTail always points to the end of the canonical path constructed
* thus far. pPathTail points to the still to be processed part of the input
* path. pElement points to the path element currently investigated.
...
...
@@ -439,7 +454,6 @@ static BOOL UNIXFS_get_unix_path(LPCWSTR pszDosPath, char *pszCanonicalPath)
do
{
char
cTemp
;
int
cLinks
=
0
;
pElement
=
pPathTail
;
pPathTail
=
strchr
(
pPathTail
+
1
,
'/'
);
...
...
@@ -452,69 +466,15 @@ static BOOL UNIXFS_get_unix_path(LPCWSTR pszDosPath, char *pszCanonicalPath)
/* Skip "/." path elements */
if
(
!
strcmp
(
"/."
,
pElement
))
{
*
pPathTail
=
cTemp
;
continue
;
}
/* Remove last element in canonical path for "/.." elements, then skip. */
if
(
!
strcmp
(
"/.."
,
pElement
))
{
}
else
if
(
!
strcmp
(
"/.."
,
pElement
))
{
/* Remove last element in canonical path for "/.." elements, then skip. */
char
*
pTemp
=
strrchr
(
pszCanonicalPath
,
'/'
);
if
(
pTemp
)
pCanonicalTail
=
pTemp
;
*
pCanonicalTail
=
'\0'
;
*
pPathTail
=
cTemp
;
continue
;
}
/* lstat returns zero on success. */
if
(
lstat
(
szPath
,
&
fileStat
))
return
FALSE
;
if
(
S_ISLNK
(
fileStat
.
st_mode
))
{
char
szSymlink
[
FILENAME_MAX
];
int
cLinkLen
,
cTailLen
;
/* Avoid infinite loop for recursive links. */
if
(
++
cLinks
>
64
)
return
FALSE
;
cLinkLen
=
readlink
(
szPath
,
szSymlink
,
FILENAME_MAX
);
if
(
cLinkLen
<
0
)
return
FALSE
;
*
pPathTail
=
cTemp
;
cTailLen
=
strlen
(
pPathTail
);
if
(
szSymlink
[
0
]
==
'/'
)
{
/* Absolute link. Copy to szPath, concat remaining path and start all over. */
if
(
cLinkLen
+
cTailLen
+
1
>
FILENAME_MAX
)
return
FALSE
;
/* Avoid double slashes. */
if
(
szSymlink
[
cLinkLen
-
1
]
==
'/'
&&
pPathTail
[
0
]
==
'/'
)
{
szSymlink
[
cLinkLen
-
1
]
=
'\0'
;
cLinkLen
--
;
}
memcpy
(
szSymlink
+
cLinkLen
,
pPathTail
,
cTailLen
+
1
);
memcpy
(
szPath
,
szSymlink
,
cLinkLen
+
cTailLen
+
1
);
*
pszCanonicalPath
=
'\0'
;
pCanonicalTail
=
pszCanonicalPath
;
pPathTail
=
szPath
;
}
else
{
/* Relative link. Expand into szPath and continue. */
char
szTemp
[
FILENAME_MAX
];
int
cTailLen
=
strlen
(
pPathTail
);
if
(
pElement
-
szPath
+
1
+
cLinkLen
+
cTailLen
+
1
>
FILENAME_MAX
)
return
FALSE
;
memcpy
(
szTemp
,
pPathTail
,
cTailLen
+
1
);
memcpy
(
pElement
+
1
,
szSymlink
,
cLinkLen
);
memcpy
(
pElement
+
1
+
cLinkLen
,
szTemp
,
cTailLen
+
1
);
pPathTail
=
pElement
;
}
}
else
{
/*
Regular d
irectory or file. Copy to canonical path */
/*
D
irectory or file. Copy to canonical path */
if
(
pCanonicalTail
-
pszCanonicalPath
+
pPathTail
-
pElement
+
1
>
FILENAME_MAX
)
return
FALSE
;
...
...
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