* util.c (valid_filename): use our own implementation of open(),
close() and unlink(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
905c157917
commit
5fb7052bb9
@ -1,3 +1,8 @@
|
|||||||
|
Thu Feb 26 13:30:34 2009 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
|
* util.c (valid_filename): use our own implementation of open(),
|
||||||
|
close() and unlink().
|
||||||
|
|
||||||
Thu Feb 26 13:23:20 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Thu Feb 26 13:23:20 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* iseq.c (cdhash_each): resurrects internal literals.
|
* iseq.c (cdhash_each): resurrects internal literals.
|
||||||
|
14
util.c
14
util.c
@ -20,14 +20,6 @@
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "missing/file.h"
|
#include "missing/file.h"
|
||||||
#endif
|
#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"
|
#include "ruby/util.h"
|
||||||
|
|
||||||
@ -345,9 +337,9 @@ valid_filename(const char *s)
|
|||||||
// It doesn't exist, so see if we can open it.
|
// It doesn't exist, so see if we can open it.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((fd = _open(s, O_CREAT|O_EXCL, 0666)) >= 0) {
|
if ((fd = open(s, O_CREAT|O_EXCL, 0666)) >= 0) {
|
||||||
_close(fd);
|
close(fd);
|
||||||
_unlink(s); /* don't leave it laying around */
|
unlink(s); /* don't leave it laying around */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (errno == EEXIST) {
|
else if (errno == EEXIST) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user