forked from FFmpeg/FFmpeg
cmdutils: remove the current working directory from the DLL search path on win32
Reviewed-by: Matt Oliver <protogonoi@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
dbd7a84c81
commit
3bf142c773
6 changed files with 21 additions and 0 deletions
|
@ -107,6 +107,15 @@ static void log_callback_report(void *ptr, int level, const char *fmt, va_list v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void init_dynload(void)
|
||||||
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
/* Calling SetDllDirectory with the empty string (but not NULL) removes the
|
||||||
|
* current working directory from the DLL search path as a security pre-caution. */
|
||||||
|
SetDllDirectory("");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static void (*program_exit)(int ret);
|
static void (*program_exit)(int ret);
|
||||||
|
|
||||||
void register_exit(void (*cb)(int ret))
|
void register_exit(void (*cb)(int ret))
|
||||||
|
|
|
@ -61,6 +61,11 @@ void register_exit(void (*cb)(int ret));
|
||||||
*/
|
*/
|
||||||
void exit_program(int ret) av_noreturn;
|
void exit_program(int ret) av_noreturn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize dynamic library loading
|
||||||
|
*/
|
||||||
|
void init_dynload(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the cmdutils option system, in particular
|
* Initialize the cmdutils option system, in particular
|
||||||
* allocate the *_opts contexts.
|
* allocate the *_opts contexts.
|
||||||
|
|
2
ffmpeg.c
2
ffmpeg.c
|
@ -4293,6 +4293,8 @@ int main(int argc, char **argv)
|
||||||
int ret;
|
int ret;
|
||||||
int64_t ti;
|
int64_t ti;
|
||||||
|
|
||||||
|
init_dynload();
|
||||||
|
|
||||||
register_exit(ffmpeg_cleanup);
|
register_exit(ffmpeg_cleanup);
|
||||||
|
|
||||||
setvbuf(stderr,NULL,_IONBF,0); /* win32 runtime needs this */
|
setvbuf(stderr,NULL,_IONBF,0); /* win32 runtime needs this */
|
||||||
|
|
2
ffplay.c
2
ffplay.c
|
@ -3776,6 +3776,8 @@ int main(int argc, char **argv)
|
||||||
char dummy_videodriver[] = "SDL_VIDEODRIVER=dummy";
|
char dummy_videodriver[] = "SDL_VIDEODRIVER=dummy";
|
||||||
char alsa_bufsize[] = "SDL_AUDIO_ALSA_SET_BUFFER_SIZE=1";
|
char alsa_bufsize[] = "SDL_AUDIO_ALSA_SET_BUFFER_SIZE=1";
|
||||||
|
|
||||||
|
init_dynload();
|
||||||
|
|
||||||
av_log_set_flags(AV_LOG_SKIP_REPEATED);
|
av_log_set_flags(AV_LOG_SKIP_REPEATED);
|
||||||
parse_loglevel(argc, argv, options);
|
parse_loglevel(argc, argv, options);
|
||||||
|
|
||||||
|
|
|
@ -3241,6 +3241,8 @@ int main(int argc, char **argv)
|
||||||
char *w_name = NULL, *w_args = NULL;
|
char *w_name = NULL, *w_args = NULL;
|
||||||
int ret, i;
|
int ret, i;
|
||||||
|
|
||||||
|
init_dynload();
|
||||||
|
|
||||||
av_log_set_flags(AV_LOG_SKIP_REPEATED);
|
av_log_set_flags(AV_LOG_SKIP_REPEATED);
|
||||||
register_exit(ffprobe_cleanup);
|
register_exit(ffprobe_cleanup);
|
||||||
|
|
||||||
|
|
|
@ -3980,6 +3980,7 @@ int main(int argc, char **argv)
|
||||||
int cfg_parsed;
|
int cfg_parsed;
|
||||||
int ret = EXIT_FAILURE;
|
int ret = EXIT_FAILURE;
|
||||||
|
|
||||||
|
init_dynload();
|
||||||
|
|
||||||
config.filename = av_strdup("/etc/ffserver.conf");
|
config.filename = av_strdup("/etc/ffserver.conf");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue