mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* file.c (rb_file_flock): immediately returns on EAGAIN if
non-blocking. [ruby-core:15672] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
586f727b8c
commit
5848032ce5
2 changed files with 9 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
|||
Thu Feb 28 11:43:56 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* file.c (rb_file_flock): immediately returns on EAGAIN if
|
||||
non-blocking. [ruby-core:15672]
|
||||
|
||||
Thu Feb 28 11:23:50 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* io.c (rb_io_getline_1): get rid of segfault. [ruby-dev:33938]
|
||||
|
|
6
file.c
6
file.c
|
@ -3256,10 +3256,10 @@ rb_file_flock(VALUE obj, VALUE operation)
|
|||
{
|
||||
#ifndef __CHECKER__
|
||||
rb_io_t *fptr;
|
||||
int op[2];
|
||||
int op[2], op1;
|
||||
|
||||
rb_secure(2);
|
||||
op[1] = NUM2INT(operation);
|
||||
op[1] = op1 = NUM2INT(operation);
|
||||
GetOpenFile(obj, fptr);
|
||||
op[0] = fptr->fd;
|
||||
|
||||
|
@ -3273,6 +3273,7 @@ rb_file_flock(VALUE obj, VALUE operation)
|
|||
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
|
||||
case EWOULDBLOCK:
|
||||
#endif
|
||||
if (op1 & LOCK_NB) goto exit;
|
||||
rb_thread_polling();
|
||||
rb_io_check_closed(fptr);
|
||||
continue;
|
||||
|
@ -3287,6 +3288,7 @@ rb_file_flock(VALUE obj, VALUE operation)
|
|||
rb_sys_fail(fptr->path);
|
||||
}
|
||||
}
|
||||
exit:
|
||||
#endif
|
||||
return INT2FIX(0);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue