diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2013-12-02 07:41:37 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2013-12-02 07:41:37 -0800 |
commit | 4c6209c7cceac38a0ce852d3d0990a6f098be87a (patch) | |
tree | 3623d0ea6607b6e383a440ef1ca180e106885cec /utf8.c | |
parent | fb9aba2ed5f2cb69da4737f1f65949da81af6b94 (diff) | |
download | txr-4c6209c7cceac38a0ce852d3d0990a6f098be87a.tar.gz txr-4c6209c7cceac38a0ce852d3d0990a6f098be87a.tar.bz2 txr-4c6209c7cceac38a0ce852d3d0990a6f098be87a.zip |
* stream.c (tail_strategy): Execute the strategy code also
in the case that the stream's FILE * handle is null. This handles
opening the file for the first time.
(make_stdio_stream_common): Do not use the FILE * handle if it is null.
(open_tail): Do not open the file immediately and error out.
This is undesirable because log files might not exist at the time
open_tail is called on them. Instead, produce a stream which contains
a null file handle, and use tail_strategy to poll for the file
to come into existence.
* utf8.c (w_freopen): Just in case freopen doesn't like a null
pointer for the existing stream, use fopen instead if that is the case.
Diffstat (limited to 'utf8.c')
-rw-r--r-- | utf8.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -376,7 +376,7 @@ FILE *w_freopen(const wchar_t *wname, const wchar_t *wmode, FILE *fold) { char *name = utf8_dup_to(wname); char *mode = utf8_dup_to(wmode); - FILE *f = freopen(name, mode, fold); + FILE *f = fold ? freopen(name, mode, fold) : fopen(name, mode); free(name); free(mode); return f; |