Doesn't really matter but it's annoying so replace it with mkstemp instead. For windows, just use _mktemp.
Unified · Split
| @@ -104,8 +104,6 @@ static void check_output(FILE *fp) · 103 unmodified lines | |||
| 104 | puts("output file ok"); | 104 | puts("output file ok"); |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | int mp_mkostemps(char *template, int suffixlen, int flags); | ||
| 108 | |||
| 109 | int main(int argc, char *argv[]) | 107 | int main(int argc, char *argv[]) |
| 110 | { | 108 | { |
| 111 | atexit(exit_cleanup); | 109 | atexit(exit_cleanup); |
| @@ -115,9 +113,17 @@ int main(int argc, char *argv[]) · 3 unmodified lines | |||
| 115 | return 1; | 113 | return 1; |
| 116 | 114 | ||
| 117 | static char path[] = "./testout.XXXXXX"; | 115 | static char path[] = "./testout.XXXXXX"; |
| 118 | out_path = mktemp(path); | 116 | |
| 117 | #ifdef _WIN32 | ||
| 118 | out_path = _mktemp(path); | ||
| 119 | if (!out_path || !*out_path) | 119 | if (!out_path || !*out_path) |
| 120 | fail("tmpfile failed\n"); | 120 | fail("tmpfile failed\n"); |
| 121 | #else | ||
| 122 | int fd = mkstemp(path); | ||
| 123 | if (fd == -1) | ||
| 124 | fail("tmpfile failed\n"); | ||
| 125 | out_path = path; | ||
| 126 | #endif | ||
| 121 | 127 | ||
| 122 | check_api_error(mpv_set_option_string(ctx, "o", out_path)); | 128 | check_api_error(mpv_set_option_string(ctx, "o", out_path)); |
| 123 | check_api_error(mpv_set_option_string(ctx, "of", "matroska")); | 129 | check_api_error(mpv_set_option_string(ctx, "of", "matroska")); |