kernel32: Use setprogname(3) to set the program name if available.
Signed-off-by: Charles Davis <cdavis5x@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
82debc093f
commit
5a4576ee09
|
@ -15047,6 +15047,7 @@ for ac_func in \
|
|||
sched_yield \
|
||||
select \
|
||||
setproctitle \
|
||||
setprogname \
|
||||
setrlimit \
|
||||
settimeofday \
|
||||
sigaltstack \
|
||||
|
|
|
@ -2026,6 +2026,7 @@ AC_CHECK_FUNCS(\
|
|||
sched_yield \
|
||||
select \
|
||||
setproctitle \
|
||||
setprogname \
|
||||
setrlimit \
|
||||
settimeofday \
|
||||
sigaltstack \
|
||||
|
|
|
@ -1118,9 +1118,20 @@ static void set_process_name( int argc, char *argv[] )
|
|||
{
|
||||
#ifdef HAVE_SETPROCTITLE
|
||||
setproctitle("-%s", argv[1]);
|
||||
#endif
|
||||
/* remove argv[0] */
|
||||
memmove( argv, argv + 1, argc * sizeof(argv[0]) );
|
||||
#elif defined(HAVE_SETPROGNAME)
|
||||
int i, offset;
|
||||
char *end = argv[argc-1] + strlen(argv[argc-1]) + 1;
|
||||
|
||||
#ifdef HAVE_PRCTL
|
||||
offset = argv[1] - argv[0];
|
||||
memmove( argv[1] - offset, argv[1], end - argv[1] );
|
||||
memset( end - offset, 0, offset );
|
||||
for (i = 1; i < argc; i++) argv[i-1] = argv[i] - offset;
|
||||
argv[i-1] = NULL;
|
||||
|
||||
setprogname( argv[0] );
|
||||
#elif defined(HAVE_PRCTL)
|
||||
int i, offset;
|
||||
char *p, *prctl_name = argv[1];
|
||||
char *end = argv[argc-1] + strlen(argv[argc-1]) + 1;
|
||||
|
@ -1141,11 +1152,11 @@ static void set_process_name( int argc, char *argv[] )
|
|||
argv[i-1] = NULL;
|
||||
}
|
||||
else
|
||||
#endif /* HAVE_PRCTL */
|
||||
{
|
||||
/* remove argv[0] */
|
||||
memmove( argv, argv + 1, argc * sizeof(argv[0]) );
|
||||
}
|
||||
#endif /* HAVE_PRCTL */
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -774,6 +774,9 @@
|
|||
/* Define to 1 if you have the `setproctitle' function. */
|
||||
#undef HAVE_SETPROCTITLE
|
||||
|
||||
/* Define to 1 if you have the `setprogname' function. */
|
||||
#undef HAVE_SETPROGNAME
|
||||
|
||||
/* Define to 1 if you have the `setrlimit' function. */
|
||||
#undef HAVE_SETRLIMIT
|
||||
|
||||
|
|
Loading…
Reference in New Issue