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
1d0cca46
Commit
1d0cca46
authored
Jan 28, 2020
by
Piotr Caban
Committed by
Alexandre Julliard
Jan 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Add support for quoted paths in _searchenv.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f17a228d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
3 deletions
+32
-3
dir.c
dlls/msvcrt/dir.c
+18
-3
dir.c
dlls/msvcrt/tests/dir.c
+14
-0
No files found.
dlls/msvcrt/dir.c
View file @
1d0cca46
...
...
@@ -1683,12 +1683,27 @@ void CDECL MSVCRT__searchenv(const char* file, const char* env, char *buf)
for
(;
*
penv
;
penv
=
(
*
end
?
end
+
1
:
end
))
{
end
=
penv
;
while
(
*
end
&&
*
end
!=
';'
)
end
++
;
/* Find end of next path */
path_len
=
end
-
penv
;
path_len
=
0
;
while
(
*
end
&&
*
end
!=
';'
&&
path_len
<
MAX_PATH
)
{
if
(
*
end
==
'"'
)
{
end
++
;
while
(
*
end
&&
*
end
!=
'"'
&&
path_len
<
MAX_PATH
)
{
path
[
path_len
++
]
=
*
end
;
end
++
;
}
if
(
*
end
==
'"'
)
end
++
;
continue
;
}
path
[
path_len
++
]
=
*
end
;
end
++
;
}
if
(
!
path_len
||
path_len
>=
MAX_PATH
)
continue
;
memcpy
(
path
,
penv
,
path_len
);
if
(
path
[
path_len
-
1
]
!=
'/'
&&
path
[
path_len
-
1
]
!=
'\\'
)
path
[
path_len
++
]
=
'\\'
;
if
(
path_len
+
fname_len
>=
MAX_PATH
)
...
...
dlls/msvcrt/tests/dir.c
View file @
1d0cca46
...
...
@@ -597,6 +597,20 @@ static void test_searchenv(void)
ok
(
!
strcmp
(
result
,
exp
),
"got %s, expected '%s'
\n
"
,
result
,
exp
);
}
strcpy
(
env1
,
"TEST_PATH="
);
strcat
(
env1
,
tmppath
);
strcat
(
env1
,
"
\"\\
search_env_test
\\\"
d
\"
i
\"
r
\"
1"
);
putenv
(
env1
);
strcpy
(
exp
,
tmppath
);
strcat
(
exp
,
files
[
0
]);
_searchenv
(
"1.dat"
,
"TEST_PATH"
,
result
);
ok
(
!
strcmp
(
result
,
exp
),
"got %s, expected '%s'
\n
"
,
result
,
exp
);
strcat
(
env1
,
";"
);
putenv
(
env1
);
_searchenv
(
"1.dat"
,
"TEST_PATH"
,
result
);
ok
(
!
result
[
0
],
"got %s, expected ''
\n
"
,
result
);
putenv
(
"TEST_PATH="
);
for
(
i
=
ARRAY_SIZE
(
files
)
-
1
;
i
>=
0
;
i
--
)
{
...
...
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