Browse Source

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>
(cherry picked from commit 3bf142c773)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n2.8.8
Hendrik Leppkes Michael Niedermayer 9 years ago
parent
commit
65fff8e71a
6 changed files with 22 additions and 0 deletions
  1. +9
    -0
      cmdutils.c
  2. +5
    -0
      cmdutils.h
  3. +2
    -0
      ffmpeg.c
  4. +2
    -0
      ffplay.c
  5. +2
    -0
      ffprobe.c
  6. +2
    -0
      ffserver.c

+ 9
- 0
cmdutils.c View File

@@ -106,6 +106,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))


+ 5
- 0
cmdutils.h View File

@@ -61,6 +61,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.


+ 2
- 0
ffmpeg.c View File

@@ -4118,6 +4118,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 */


+ 2
- 0
ffplay.c View File

@@ -3684,6 +3684,8 @@ int main(int argc, char **argv)
VideoState *is;
char dummy_videodriver[] = "SDL_VIDEODRIVER=dummy";

init_dynload();

av_log_set_flags(AV_LOG_SKIP_REPEATED);
parse_loglevel(argc, argv, options);



+ 2
- 0
ffprobe.c View File

@@ -3142,6 +3142,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);



+ 2
- 0
ffserver.c View File

@@ -3817,6 +3817,8 @@ int main(int argc, char **argv)
struct sigaction sigact = { { 0 } };
int ret = 0;

init_dynload();

config.filename = av_strdup("/etc/ffserver.conf");

parse_loglevel(argc, argv, options);


Loading…
Cancel
Save