mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* win32/win32.{h,c} (rb_w32_{f,fd,fs}open): workaround for bcc32's
{f,fd,fs}open bug. set errno EMFILE and EBADF. [ruby-dev:23963] * test/drb/drbtest.rb: fix method duplication. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9a983e5150
commit
9d07076bef
4 changed files with 72 additions and 3 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
Sun Jul 25 10:56:28 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
|
||||||
|
|
||||||
|
* win32/win32.{h,c} (rb_w32_{f,fd,fs}open): workaround for bcc32's
|
||||||
|
{f,fd,fs}open bug. set errno EMFILE and EBADF. [ruby-dev:23963]
|
||||||
|
|
||||||
|
* test/drb/drbtest.rb: fix method duplication.
|
||||||
|
|
||||||
Sat Jul 24 13:32:47 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Sat Jul 24 13:32:47 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* range.c (rb_range_beg_len): returns Qnil only when "beg" points
|
* range.c (rb_range_beg_len): returns Qnil only when "beg" points
|
||||||
|
|
|
@ -15,9 +15,6 @@ class DRbService
|
||||||
@@ruby = EnvUtil.rubybin
|
@@ruby = EnvUtil.rubybin
|
||||||
@@ruby += " -d" if $DEBUG
|
@@ruby += " -d" if $DEBUG
|
||||||
@@dir = File.dirname(File.expand_path(__FILE__))
|
@@dir = File.dirname(File.expand_path(__FILE__))
|
||||||
def self.manager
|
|
||||||
@@manager
|
|
||||||
end
|
|
||||||
def self.add_service_command(nm)
|
def self.add_service_command(nm)
|
||||||
DRb::ExtServManager.command[nm] = "#{@@ruby} #{@@dir}/#{nm}"
|
DRb::ExtServManager.command[nm] = "#{@@ruby} #{@@dir}/#{nm}"
|
||||||
end
|
end
|
||||||
|
|
|
@ -3330,3 +3330,55 @@ rb_w32_snprintf(char *buf, size_t size, const char *format, ...)
|
||||||
va_end(va);
|
va_end(va);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Fix bcc32's stdio bug
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
static int
|
||||||
|
too_many_files()
|
||||||
|
{
|
||||||
|
FILE *f;
|
||||||
|
for (f = _streams; f < _streams + _nfile; f++) {
|
||||||
|
if (f->fd < 0) return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef fopen
|
||||||
|
FILE *
|
||||||
|
rb_w32_fopen(const char *path, const char *mode)
|
||||||
|
{
|
||||||
|
FILE *f = (errno = 0, fopen(path, mode));
|
||||||
|
if (f == NULL && errno == 0) {
|
||||||
|
if (too_many_files())
|
||||||
|
errno = EMFILE;
|
||||||
|
}
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
FILE *
|
||||||
|
rb_w32_fdopen(int handle, char *type)
|
||||||
|
{
|
||||||
|
FILE *f = (errno = 0, _fdopen(handle, type));
|
||||||
|
if (f == NULL && errno == 0) {
|
||||||
|
if (handle < 0)
|
||||||
|
errno = EBADF;
|
||||||
|
else if (too_many_files())
|
||||||
|
errno = EMFILE;
|
||||||
|
}
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
FILE *
|
||||||
|
rb_w32_fsopen(const char *path, const char *mode, int shflags)
|
||||||
|
{
|
||||||
|
FILE *f = (errno = 0, _fsopen(path, mode, shflags));
|
||||||
|
if (f == NULL && errno == 0) {
|
||||||
|
if (too_many_files())
|
||||||
|
errno = EMFILE;
|
||||||
|
}
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -115,6 +115,12 @@ extern "C++" {
|
||||||
#define sopen _sopen
|
#define sopen _sopen
|
||||||
#undef fstat
|
#undef fstat
|
||||||
#define fstat(fd,st) rb_w32_fstat(fd,st)
|
#define fstat(fd,st) rb_w32_fstat(fd,st)
|
||||||
|
#undef fopen
|
||||||
|
#define fopen(p, m) rb_w32_fopen(p, m)
|
||||||
|
#undef fdopen
|
||||||
|
#define fdopen(h, m) rb_w32_fdopen(h, m)
|
||||||
|
#undef fsopen
|
||||||
|
#define fsopen(p, m, sh) rb_w32_fsopen(p, m, sh)
|
||||||
#endif
|
#endif
|
||||||
#define fsync(h) _commit(h)
|
#define fsync(h) _commit(h)
|
||||||
#undef stat
|
#undef stat
|
||||||
|
@ -179,6 +185,13 @@ extern int rb_w32_aspawn(int, const char *, char *const *);
|
||||||
extern int kill(int, int);
|
extern int kill(int, int);
|
||||||
extern pid_t rb_w32_getpid(void);
|
extern pid_t rb_w32_getpid(void);
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
extern int rb_w32_fstat(int, struct stat *);
|
||||||
|
extern FILE *rb_w32_fopen(const char *, const char *);
|
||||||
|
extern FILE *rb_w32_fdopen(int, char *);
|
||||||
|
extern FILE *rb_w32_fsopen(const char *, const char *, int);
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#if !defined __MINGW32__ || defined __NO_ISOCEXT
|
#if !defined __MINGW32__ || defined __NO_ISOCEXT
|
||||||
#ifndef isnan
|
#ifndef isnan
|
||||||
|
|
Loading…
Reference in a new issue