mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Merge branch 'bug1376'
This commit is contained in:
+11
-3
@@ -2191,12 +2191,20 @@ write_chunks_to_file_impl(const char *fname, const smartlist_t *chunks,
|
||||
return -1;
|
||||
}
|
||||
|
||||
/** Given a smartlist of sized_chunk_t, write them atomically to a file
|
||||
* <b>fname</b>, overwriting or creating the file as necessary. */
|
||||
/** Given a smartlist of sized_chunk_t, write them to a file
|
||||
* <b>fname</b>, overwriting or creating the file as necessary.
|
||||
* If <b>no_tempfile</b> is 0 then the file will be written
|
||||
* atomically. */
|
||||
int
|
||||
write_chunks_to_file(const char *fname, const smartlist_t *chunks, int bin)
|
||||
write_chunks_to_file(const char *fname, const smartlist_t *chunks, int bin,
|
||||
int no_tempfile)
|
||||
{
|
||||
int flags = OPEN_FLAGS_REPLACE|(bin?O_BINARY:O_TEXT);
|
||||
|
||||
if (no_tempfile) {
|
||||
/* O_APPEND stops write_chunks_to_file from using tempfiles */
|
||||
flags |= O_APPEND;
|
||||
}
|
||||
return write_chunks_to_file_impl(fname, chunks, flags);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -365,7 +365,7 @@ typedef struct sized_chunk_t {
|
||||
size_t len;
|
||||
} sized_chunk_t;
|
||||
int write_chunks_to_file(const char *fname, const struct smartlist_t *chunks,
|
||||
int bin);
|
||||
int bin, int no_tempfile);
|
||||
int append_bytes_to_file(const char *fname, const char *str, size_t len,
|
||||
int bin);
|
||||
int write_bytes_to_new_file(const char *fname, const char *str, size_t len,
|
||||
|
||||
Reference in New Issue
Block a user