summaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-26 04:31:21 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-26 04:31:21 +0000
commit5cb2d7e487358dc6be89e5a212f28ed1ea132c35 (patch)
tree7a5314ab4d0eccbc6d439eb8aebcc6de5103cc6d /util.c
parentf9c9e7ac0abd05c5773433601ca8bfe314cbf73f (diff)
downloadruby-5cb2d7e487358dc6be89e5a212f28ed1ea132c35.tar.gz
ruby-5cb2d7e487358dc6be89e5a212f28ed1ea132c35.tar.xz
ruby-5cb2d7e487358dc6be89e5a212f28ed1ea132c35.zip
* util.c (valid_filename): use our own implementation of open(),
close() and unlink(). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'util.c')
-rw-r--r--util.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/util.c b/util.c
index f2b38420b..2297e2f99 100644
--- a/util.c
+++ b/util.c
@@ -20,14 +20,6 @@
#ifdef _WIN32
#include "missing/file.h"
#endif
-#if defined(__CYGWIN32__)
-#define _open open
-#define _close close
-#define _unlink unlink
-#define _access access
-#elif defined(_WIN32)
-#include <io.h>
-#endif
#include "ruby/util.h"
@@ -345,9 +337,9 @@ valid_filename(const char *s)
// It doesn't exist, so see if we can open it.
*/
- if ((fd = _open(s, O_CREAT|O_EXCL, 0666)) >= 0) {
- _close(fd);
- _unlink(s); /* don't leave it laying around */
+ if ((fd = open(s, O_CREAT|O_EXCL, 0666)) >= 0) {
+ close(fd);
+ unlink(s); /* don't leave it laying around */
return 1;
}
else if (errno == EEXIST) {