summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/io.c b/io.c
index 4c63d83648..a0be6a9ef0 100644
--- a/io.c
+++ b/io.c
@@ -55,8 +55,12 @@ struct timeval {
#include <sys/errno.h>
#include <unix.mac.h>
#include <compat.h>
- extern char* strdup(const char*);
#endif
+
+#ifndef strdup
+char *strdup();
+#endif
+
extern void Init_File _((void));
#ifdef __BEOS__
@@ -866,9 +870,11 @@ static void
rb_io_fptr_close(fptr)
OpenFile *fptr;
{
+ int fd;
+
if (fptr->f == NULL && fptr->f2 == NULL) return;
- rb_thread_fd_close(fileno(fptr->f));
+ fd = fileno(fptr->f);
if (fptr->finalize) {
(*fptr->finalize)(fptr);
}
@@ -876,6 +882,7 @@ rb_io_fptr_close(fptr)
fptr_finalize(fptr);
}
fptr->f = fptr->f2 = NULL;
+ rb_thread_fd_close(fd);
}
void