summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-10 09:45:29 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-10 09:45:29 +0000
commitff381ca19bde87981e2c53cab618ae1e771869bf (patch)
treefcfdaa93a08229b80f3a0a3cf996d899666e0f41 /process.c
parent93df5a0a906587244feff91e2bc1eecb11e31d28 (diff)
* process.c (rb_execarg_parent_start1): Handle EINTR.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r--process.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/process.c b/process.c
index ffdfdf6..ca061ad 100644
--- a/process.c
+++ b/process.c
@@ -2286,7 +2286,6 @@ fill_envp_buf_i(st_data_t st_key, st_data_t st_val, st_data_t arg)
static long run_exec_dup2_tmpbuf_size(long n);
struct open_struct {
- int entered;
VALUE fname;
int oflags;
mode_t perm;
@@ -2299,8 +2298,8 @@ open_func(void *ptr)
{
struct open_struct *data = ptr;
const char *fname = RSTRING_PTR(data->fname);
- data->entered = 1;
data->ret = parent_redirect_open(fname, data->oflags, data->perm);
+ data->err = errno;
return NULL;
}
@@ -2327,18 +2326,21 @@ rb_execarg_parent_start1(VALUE execarg_obj)
if (NIL_P(fd2v)) {
struct open_struct open_data;
FilePathValue(vpath);
- do {
- rb_thread_check_ints();
- open_data.entered = 0;
- open_data.fname = vpath;
- open_data.oflags = flags;
- open_data.perm = perm;
- open_data.ret = -1;
- rb_thread_call_without_gvl2(open_func, (void *)&open_data, RUBY_UBF_IO, 0);
- } while (!open_data.entered);
- fd2 = open_data.ret;
- if (fd2 == -1)
+ again:
+ open_data.fname = vpath;
+ open_data.oflags = flags;
+ open_data.perm = perm;
+ open_data.ret = -1;
+ open_data.err = EINTR;
+ rb_thread_call_without_gvl2(open_func, (void *)&open_data, RUBY_UBF_IO, 0);
+ if (open_data.ret == -1) {
+ if (open_data.err == EINTR) {
+ rb_thread_check_ints();
+ goto again;
+ }
rb_sys_fail("open");
+ }
+ fd2 = open_data.ret;
rb_update_max_fd(fd2);
RARRAY_ASET(param, 3, INT2FIX(fd2));
rb_thread_check_ints();