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
53acb6e7
Commit
53acb6e7
authored
Oct 21, 2022
by
Piotr Caban
Committed by
Alexandre Julliard
Oct 21, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Fix _putenv_s return value on error.
parent
8f6b8e97
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
environ.c
dlls/msvcrt/environ.c
+12
-7
No files found.
dlls/msvcrt/environ.c
View file @
53acb6e7
...
...
@@ -165,17 +165,22 @@ finish:
*/
errno_t
CDECL
_putenv_s
(
const
char
*
name
,
const
char
*
value
)
{
int
ret
;
errno_t
ret
=
0
;
TRACE
(
"%s %s
\n
"
,
debugstr_a
(
name
),
debugstr_a
(
value
));
if
(
!
MSVCRT_CHECK_PMT
(
name
!=
NULL
))
return
-
1
;
if
(
!
MSVCRT_CHECK_PMT
(
value
!=
NULL
))
return
-
1
;
if
(
!
MSVCRT_CHECK_PMT
(
name
!=
NULL
))
return
EINVAL
;
if
(
!
MSVCRT_CHECK_PMT
(
value
!=
NULL
))
return
EINVAL
;
ret
=
SetEnvironmentVariableA
(
name
,
value
[
0
]
?
value
:
NULL
)
?
0
:
-
1
;
/* _putenv returns success on deletion of nonexistent variable, unlike [Rtl]SetEnvironmentVariable */
if
((
ret
==
-
1
)
&&
(
GetLastError
()
==
ERROR_ENVVAR_NOT_FOUND
))
ret
=
0
;
if
(
!
SetEnvironmentVariableA
(
name
,
value
[
0
]
?
value
:
NULL
))
{
/* _putenv returns success on deletion of nonexistent variable */
if
(
GetLastError
()
!=
ERROR_ENVVAR_NOT_FOUND
)
{
msvcrt_set_errno
(
GetLastError
());
ret
=
*
_errno
();
}
}
MSVCRT__environ
=
msvcrt_SnapshotOfEnvironmentA
(
MSVCRT__environ
);
MSVCRT__wenviron
=
msvcrt_SnapshotOfEnvironmentW
(
MSVCRT__wenviron
);
...
...
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