summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-03-26 08:57:16 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-03-26 08:57:16 +0000
commitde51a663b4300777be15003388070748a974e7c7 (patch)
tree635c8f7cfaf91bc155d82dd62b69af9d36f95e16 /file.c
parent44f754bd87e4b800118c59020d67123430535b9f (diff)
* eval.c: remove TMP_PROTECT_END to prevent C_ALLOCA crash.
* file.c (rb_file_flock): do not trap EINTR. * missing/flock.c (flock): returns the value from lockf(2) directly. * eval.c (ev_const_defined): should ignore toplevel cbase (Object). * eval.c (ev_const_get): ditto. * ext/md5/md5.h: replace by independent md5 implementation contributed by L. Peter Deutsch (thanks). * ext/md5/md5init.c: adopted to Deutsch's md5 implementation. * pack.c (pack_unpack): string from P/p should be tainted. * ext/curses/curses.c: curses on Mac OS X public beta does not have _maxx etc. * marshal.c (w_object): should truncate trailing zero short for bignums. * object.c (sym_intern): new method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r--file.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/file.c b/file.c
index 84d79a9..2881e6c 100644
--- a/file.c
+++ b/file.c
@@ -1584,7 +1584,7 @@ rb_file_truncate(obj, len)
# define LOCK_UN 8
# endif
-#if defined(EWOULDBLOCK) && 0
+#if 0
static int
rb_thread_flock(fd, op, fptr)
int fd, op;
@@ -1596,11 +1596,14 @@ rb_thread_flock(fd, op, fptr)
op |= LOCK_NB;
while (flock(fd, op) < 0) {
switch (errno) {
- case EINTR: /* can be happen? */
+ case EAGAIN:
+ case EACCES:
+#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
case EWOULDBLOCK:
+#endif
rb_thread_polling(); /* busy wait */
rb_io_check_closed(fptr);
- break;
+ continue;
default:
return -1;
}
@@ -1629,11 +1632,14 @@ rb_file_flock(obj, operation)
ret = flock(fileno(fptr->f), NUM2INT(operation));
TRAP_END;
if (ret < 0) {
-#ifdef EWOULDBLOCK
- if (errno == EWOULDBLOCK) {
- return Qfalse;
- }
+ switch (errno) {
+ case EAGAIN:
+ case EACCES:
+#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
+ case EWOULDBLOCK:
#endif
+ return Qfalse;
+ }
rb_sys_fail(fptr->path);
}
#endif