[FFmpeg-devel] [PATCH] set FONTCONFIG_PATH relative to ffmpeg binary, if it is a static build
george at nsup.org
Mon Feb 17 15:43:23 CET 2014
Le nonidi 29 pluviôse, an CCXXII, Reimar Döffinger a écrit :
> >> There is something fishy about this: getcwd() will return you the path where
> >> ffmpeg was started from too. There is no reliable portable way of finding
> >> the path of the binary that started a program.
> It depends in which context you define reliable.
> If you only think of the shell or system() calls and don't consider people
> being careless with exec arguments then combining cwd and path from
> argv should work.
That is the reason I added "reliable" in the first place: this method will
work most times, but can fail especially with wrappers and GUI.
> If there are better OS-specific methods, having such a function that does
> the best possible in libavutil might be nice...
That is right, av_get_application_path() would probably be a useful
function, provided the doc urges people not tu abuse it.
For Linux systems, readlink("/proc/self/exe") should do the trick quite
> There are good security arguments to not accept relative paths, so
> fontconfig might ignore them on purpose.
I checked before posting:
$ FONTCONFIG_PATH=../fonts strace fc-list |& grep fonts | head -n 2
access("../fonts/fonts.conf", R_OK) = -1 ENOENT (No such file or directory)
access("/etc/fonts/fonts.conf", R_OK) = 0
It accepts them.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 819 bytes
Desc: Digital signature
More information about the ffmpeg-devel