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
36bb7175
Commit
36bb7175
authored
Feb 06, 2023
by
Brendan Shanks
Committed by
Alexandre Julliard
Feb 08, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
loader: In macOS preloader, fix an environment variable sometimes being lost.
parent
c1fb8fe2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
14 deletions
+11
-14
preloader_mac.c
loader/preloader_mac.c
+11
-14
No files found.
loader/preloader_mac.c
View file @
36bb7175
...
...
@@ -619,25 +619,22 @@ static inline void get_dyld_func( const char *name, void **func )
static
void
fixup_stack
(
void
*
stack
)
{
int
*
pargc
;
char
**
argv
,
**
env
,
**
apple
,
**
apple_end
;
char
**
argv
,
**
env_new
;
static
char
dummyvar
[]
=
"WINEPRELOADERDUMMYVAR=1"
;
pargc
=
stack
;
argv
=
(
char
**
)
pargc
+
1
;
env
=
&
argv
[
*
pargc
-
1
]
+
2
;
apple
=
env
;
while
(
*
apple
)
apple
++
;
apple
++
;
apple_end
=
apple
;
while
(
*
apple_end
)
apple_end
++
;
apple_end
++
;
/* decrement argc, and
move all the data between &argv[1] and apple_end down to start at &
argv[0] */
/* decrement argc, and
"remove"
argv[0] */
*
pargc
=
*
pargc
-
1
;
memmove
(
&
argv
[
0
],
&
argv
[
1
],
(
char
*
)
apple_end
-
(
char
*
)
&
argv
[
1
]);
memmove
(
&
argv
[
0
],
&
argv
[
1
],
(
*
pargc
+
1
)
*
sizeof
(
char
*
)
);
env_new
=
&
argv
[
*
pargc
-
1
]
+
2
;
/* In the launched binary on some OSes, _NSGetEnviron() returns
* the original 'environ' pointer, so env_new[0] would be ignored.
* Put a dummy variable in env_new[0], so nothing is lost in this case.
*/
env_new
[
0
]
=
dummyvar
;
}
static
void
set_program_vars
(
void
*
stack
,
void
*
mod
)
...
...
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