summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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"),