]>
git.scottworley.com Git - overonion/blob - temp_file.c
10 void make_temporary_file(char** temp_filename
, FILE** temp_file
) {
11 char* TMPDIR
= getenv("TMPDIR");
15 if (asprintf(temp_filename
, "%s/reverse.XXXXXX", TMPDIR
) == -1) {
16 errx(EX_OSERR
, "Could not assemble temporary filename");
18 int fd
= mkstemp(*temp_filename
);
19 if (fd
== -1) err(EX_IOERR
, "Could not make a temporary file");
20 *temp_file
= fdopen(fd
, "w");
21 if (*temp_file
== NULL
) err(EX_IOERR
, "Could not open temporary file");