mirror of
https://github.com/librempeg/librempeg
synced 2024-11-21 16:44:05 +00:00
avutil/file_open: Fix build error with wasi
Don't assume tempnam is available when !HAVE_MKSTEMP. Check tempnam explicitly in configure. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com> Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
parent
41c1b79d3a
commit
ce9c8acfc4
2
configure
vendored
2
configure
vendored
@ -2408,6 +2408,7 @@ SYSTEM_FUNCS="
|
|||||||
sysconf
|
sysconf
|
||||||
sysctl
|
sysctl
|
||||||
sysctlbyname
|
sysctlbyname
|
||||||
|
tempnam
|
||||||
usleep
|
usleep
|
||||||
UTGetOSTypeFromString
|
UTGetOSTypeFromString
|
||||||
VirtualAlloc
|
VirtualAlloc
|
||||||
@ -6542,6 +6543,7 @@ check_struct "sys/stat.h" "struct stat" st_mtim.tv_nsec -D_BSD_SOURCE
|
|||||||
check_func strerror_r
|
check_func strerror_r
|
||||||
check_func sysconf
|
check_func sysconf
|
||||||
check_func sysctl
|
check_func sysctl
|
||||||
|
check_func tempnam
|
||||||
check_func usleep
|
check_func usleep
|
||||||
|
|
||||||
check_func_headers conio.h kbhit
|
check_func_headers conio.h kbhit
|
||||||
|
@ -111,7 +111,10 @@ int avpriv_tempfile(const char *prefix, char **filename, int log_offset, void *l
|
|||||||
{
|
{
|
||||||
FileLogContext file_log_ctx = { &file_log_ctx_class, log_offset, log_ctx };
|
FileLogContext file_log_ctx = { &file_log_ctx_class, log_offset, log_ctx };
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
#if !HAVE_MKSTEMP
|
#if HAVE_MKSTEMP
|
||||||
|
size_t len = strlen(prefix) + 12; /* room for "/tmp/" and "XXXXXX\0" */
|
||||||
|
*filename = av_malloc(len);
|
||||||
|
#elif HAVE_TEMPNAM
|
||||||
void *ptr= tempnam(NULL, prefix);
|
void *ptr= tempnam(NULL, prefix);
|
||||||
if(!ptr)
|
if(!ptr)
|
||||||
ptr= tempnam(".", prefix);
|
ptr= tempnam(".", prefix);
|
||||||
@ -119,8 +122,7 @@ int avpriv_tempfile(const char *prefix, char **filename, int log_offset, void *l
|
|||||||
#undef free
|
#undef free
|
||||||
free(ptr);
|
free(ptr);
|
||||||
#else
|
#else
|
||||||
size_t len = strlen(prefix) + 12; /* room for "/tmp/" and "XXXXXX\0" */
|
return AVERROR(ENOSYS);
|
||||||
*filename = av_malloc(len);
|
|
||||||
#endif
|
#endif
|
||||||
/* -----common section-----*/
|
/* -----common section-----*/
|
||||||
if (!*filename) {
|
if (!*filename) {
|
||||||
|
Loading…
Reference in New Issue
Block a user