Message ID | 20160808132741.5180-1-h.leppkes@gmail.com |
---|---|
State | Accepted |
Commit | 3bf142c77337814458ed8e036796934032d9837f |
Headers | show |
On 8 August 2016 at 23:27, Hendrik Leppkes <h.leppkes@gmail.com> wrote: > --- > cmdutils.c | 9 +++++++++ > cmdutils.h | 5 +++++ > ffmpeg.c | 2 ++ > ffplay.c | 2 ++ > ffprobe.c | 2 ++ > ffserver.c | 1 + > 6 files changed, 21 insertions(+) > > diff --git a/cmdutils.c b/cmdutils.c > index 03a4836..6960f8c 100644 > --- a/cmdutils.c > +++ b/cmdutils.c > @@ -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); > > void register_exit(void (*cb)(int ret)) > diff --git a/cmdutils.h b/cmdutils.h > index 83ea4ad..67bf484 100644 > --- a/cmdutils.h > +++ b/cmdutils.h > @@ -62,6 +62,11 @@ void register_exit(void (*cb)(int ret)); > void exit_program(int ret) av_noreturn; > > /** > + * Initialize dynamic library loading > + */ > +void init_dynload(void); > + > +/** > * Initialize the cmdutils option system, in particular > * allocate the *_opts contexts. > */ > diff --git a/ffmpeg.c b/ffmpeg.c > index d6282bd..bae515d 100644 > --- a/ffmpeg.c > +++ b/ffmpeg.c > @@ -4293,6 +4293,8 @@ int main(int argc, char **argv) > int ret; > int64_t ti; > > + init_dynload(); > + > register_exit(ffmpeg_cleanup); > > setvbuf(stderr,NULL,_IONBF,0); /* win32 runtime needs this */ > diff --git a/ffplay.c b/ffplay.c > index 651e0cf..adbe9cb 100644 > --- a/ffplay.c > +++ b/ffplay.c > @@ -3776,6 +3776,8 @@ int main(int argc, char **argv) > char dummy_videodriver[] = "SDL_VIDEODRIVER=dummy"; > char alsa_bufsize[] = "SDL_AUDIO_ALSA_SET_BUFFER_SIZE=1"; > > + init_dynload(); > + > av_log_set_flags(AV_LOG_SKIP_REPEATED); > parse_loglevel(argc, argv, options); > > diff --git a/ffprobe.c b/ffprobe.c > index a49be6a..657867d 100644 > --- a/ffprobe.c > +++ b/ffprobe.c > @@ -3241,6 +3241,8 @@ int main(int argc, char **argv) > char *w_name = NULL, *w_args = NULL; > int ret, i; > > + init_dynload(); > + > av_log_set_flags(AV_LOG_SKIP_REPEATED); > register_exit(ffprobe_cleanup); > > diff --git a/ffserver.c b/ffserver.c > index 1a27583..453d790 100644 > --- a/ffserver.c > +++ b/ffserver.c > @@ -3980,6 +3980,7 @@ int main(int argc, char **argv) > int cfg_parsed; > int ret = EXIT_FAILURE; > > + init_dynload(); > > config.filename = av_strdup("/etc/ffserver.conf"); > > -- > LGTM
On Tue, Aug 09, 2016 at 12:25:21AM +1000, Matt Oliver wrote: > On 8 August 2016 at 23:27, Hendrik Leppkes <h.leppkes@gmail.com> wrote: > > > --- > > cmdutils.c | 9 +++++++++ > > cmdutils.h | 5 +++++ > > ffmpeg.c | 2 ++ > > ffplay.c | 2 ++ > > ffprobe.c | 2 ++ > > ffserver.c | 1 + > > 6 files changed, 21 insertions(+) > > > > diff --git a/cmdutils.c b/cmdutils.c > > index 03a4836..6960f8c 100644 > > --- a/cmdutils.c > > +++ b/cmdutils.c > > @@ -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); > > > > void register_exit(void (*cb)(int ret)) > > diff --git a/cmdutils.h b/cmdutils.h > > index 83ea4ad..67bf484 100644 > > --- a/cmdutils.h > > +++ b/cmdutils.h > > @@ -62,6 +62,11 @@ void register_exit(void (*cb)(int ret)); > > void exit_program(int ret) av_noreturn; > > > > /** > > + * Initialize dynamic library loading > > + */ > > +void init_dynload(void); > > + > > +/** > > * Initialize the cmdutils option system, in particular > > * allocate the *_opts contexts. > > */ > > diff --git a/ffmpeg.c b/ffmpeg.c > > index d6282bd..bae515d 100644 > > --- a/ffmpeg.c > > +++ b/ffmpeg.c > > @@ -4293,6 +4293,8 @@ int main(int argc, char **argv) > > int ret; > > int64_t ti; > > > > + init_dynload(); > > + > > register_exit(ffmpeg_cleanup); > > > > setvbuf(stderr,NULL,_IONBF,0); /* win32 runtime needs this */ > > diff --git a/ffplay.c b/ffplay.c > > index 651e0cf..adbe9cb 100644 > > --- a/ffplay.c > > +++ b/ffplay.c > > @@ -3776,6 +3776,8 @@ int main(int argc, char **argv) > > char dummy_videodriver[] = "SDL_VIDEODRIVER=dummy"; > > char alsa_bufsize[] = "SDL_AUDIO_ALSA_SET_BUFFER_SIZE=1"; > > > > + init_dynload(); > > + > > av_log_set_flags(AV_LOG_SKIP_REPEATED); > > parse_loglevel(argc, argv, options); > > > > diff --git a/ffprobe.c b/ffprobe.c > > index a49be6a..657867d 100644 > > --- a/ffprobe.c > > +++ b/ffprobe.c > > @@ -3241,6 +3241,8 @@ int main(int argc, char **argv) > > char *w_name = NULL, *w_args = NULL; > > int ret, i; > > > > + init_dynload(); > > + > > av_log_set_flags(AV_LOG_SKIP_REPEATED); > > register_exit(ffprobe_cleanup); > > > > diff --git a/ffserver.c b/ffserver.c > > index 1a27583..453d790 100644 > > --- a/ffserver.c > > +++ b/ffserver.c > > @@ -3980,6 +3980,7 @@ int main(int argc, char **argv) > > int cfg_parsed; > > int ret = EXIT_FAILURE; > > > > + init_dynload(); > > > > config.filename = av_strdup("/etc/ffserver.conf"); > > > > -- > > > > LGTM applied thanks to all [...]
diff --git a/cmdutils.c b/cmdutils.c index 03a4836..6960f8c 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -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); void register_exit(void (*cb)(int ret)) diff --git a/cmdutils.h b/cmdutils.h index 83ea4ad..67bf484 100644 --- a/cmdutils.h +++ b/cmdutils.h @@ -62,6 +62,11 @@ void register_exit(void (*cb)(int ret)); void exit_program(int ret) av_noreturn; /** + * Initialize dynamic library loading + */ +void init_dynload(void); + +/** * Initialize the cmdutils option system, in particular * allocate the *_opts contexts. */ diff --git a/ffmpeg.c b/ffmpeg.c index d6282bd..bae515d 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -4293,6 +4293,8 @@ int main(int argc, char **argv) int ret; int64_t ti; + init_dynload(); + register_exit(ffmpeg_cleanup); setvbuf(stderr,NULL,_IONBF,0); /* win32 runtime needs this */ diff --git a/ffplay.c b/ffplay.c index 651e0cf..adbe9cb 100644 --- a/ffplay.c +++ b/ffplay.c @@ -3776,6 +3776,8 @@ int main(int argc, char **argv) char dummy_videodriver[] = "SDL_VIDEODRIVER=dummy"; char alsa_bufsize[] = "SDL_AUDIO_ALSA_SET_BUFFER_SIZE=1"; + init_dynload(); + av_log_set_flags(AV_LOG_SKIP_REPEATED); parse_loglevel(argc, argv, options); diff --git a/ffprobe.c b/ffprobe.c index a49be6a..657867d 100644 --- a/ffprobe.c +++ b/ffprobe.c @@ -3241,6 +3241,8 @@ int main(int argc, char **argv) char *w_name = NULL, *w_args = NULL; int ret, i; + init_dynload(); + av_log_set_flags(AV_LOG_SKIP_REPEATED); register_exit(ffprobe_cleanup); diff --git a/ffserver.c b/ffserver.c index 1a27583..453d790 100644 --- a/ffserver.c +++ b/ffserver.c @@ -3980,6 +3980,7 @@ int main(int argc, char **argv) int cfg_parsed; int ret = EXIT_FAILURE; + init_dynload(); config.filename = av_strdup("/etc/ffserver.conf");