42 static int win32_open(
const char *filename_utf8,
int oflag,
int pmode)
48 if (utf8towchar(filename_utf8, &filename_w))
53 fd = _wsopen(filename_w, oflag, SH_DENYNO, pmode);
56 if (fd != -1 || (oflag & O_CREAT))
61 return _sopen(filename_utf8, oflag, SH_DENYNO, pmode);
63 #define open win32_open
69 unsigned int mode = 0;
74 mode = va_arg(ap,
unsigned int);
87 if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
110 int avpriv_tempfile(
const char *prefix,
char **filename,
int log_offset,
void *log_ctx)
115 void *ptr= tempnam(
NULL, prefix);
117 ptr= tempnam(
".", prefix);
122 size_t len = strlen(prefix) + 12;
140 fd = mkstemp(*filename);
141 #if defined(_WIN32) || defined (__ANDROID__) || defined(__DJGPP__)
144 fd = mkstemp(*filename);
151 av_log(&file_log_ctx,
AV_LOG_ERROR,
"ff_tempfile: Cannot open temporary file %s\n", *filename);
162 const char *m =
mode;
165 case 'r': access = O_RDONLY;
break;
166 case 'w': access = O_CREAT|O_WRONLY|O_TRUNC;
break;
167 case 'a': access = O_CREAT|O_WRONLY|O_APPEND;
break;
174 access &= ~(O_RDONLY | O_WRONLY);
176 }
else if (*m ==
'b') {
189 return fdopen(fd,
mode);