summaryrefslogtreecommitdiffstats
path: root/stream.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-02-27 18:33:48 -0800
committerKaz Kylheku <kaz@kylheku.com>2016-02-27 18:33:48 -0800
commitf94b59c49ee64695fd591a9eedf3ceea3737189a (patch)
tree10b2188e2a41e4d2cbf999410cde999f21577334 /stream.c
parent4496c575892fa34ae9aabf4e1c0f7da87f10c4c2 (diff)
downloadtxr-f94b59c49ee64695fd591a9eedf3ceea3737189a.tar.gz
txr-f94b59c49ee64695fd591a9eedf3ceea3737189a.tar.bz2
txr-f94b59c49ee64695fd591a9eedf3ceea3737189a.zip
open-fileno: errno usage.
* stream.c (open_fileno): clear errno to 0 before fdopen.
Diffstat (limited to 'stream.c')
-rw-r--r--stream.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/stream.c b/stream.c
index b55cd44c..849e7570 100644
--- a/stream.c
+++ b/stream.c
@@ -3148,7 +3148,7 @@ val open_file(val path, val mode_str)
val open_fileno(val fd, val mode_str)
{
struct stdio_mode m;
- FILE *f = w_fdopen(c_num(fd), c_str(normalize_mode(&m, mode_str)));
+ FILE *f = (errno = 0, w_fdopen(c_num(fd), c_str(normalize_mode(&m, mode_str))));
if (!f)
uw_throwf(file_error_s, lit("error opening descriptor ~a: ~d/~s"),