diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-02-18 04:13:09 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-02-18 04:13:09 +0000 |
commit | 562f256c54dbb1a0a26699ba3dceba24062a9b11 (patch) | |
tree | 765bda387c202be5cf3db52886842b7d79ba29f7 /ext/pty/pty.c | |
parent | bf6efa76c0abcd1a2577cf0ca49f8137d3483b60 (diff) |
* configure.in (pid_t, uid_t, gid_t): check if defined.
* intern.h, process.c, rubyio.h, ext/etc/etc.c, ext/pty/pty.c: use
rb_{pid,uid,gid}_t instead of plain int. [ruby-dev:30376]
* ext/etc/extconf.rb (PIDT2NUM, NUM2PIDT, UIDT2NUM, NUM2UIDT, GIDT2NUM,
NUM2GIDT): moved to configure.in.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/pty/pty.c')
-rw-r--r-- | ext/pty/pty.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/ext/pty/pty.c b/ext/pty/pty.c index 5d86525daa..ce5bac89af 100644 --- a/ext/pty/pty.c +++ b/ext/pty/pty.c @@ -147,7 +147,8 @@ raise_from_wait(char *state, struct pty_info *info) static VALUE pty_syswait(struct pty_info *info) { - int cpid, status; + rb_pid_t cpid; + int status; for (;;) { cpid = rb_waitpid(info->child_pid, &status, WUNTRACED); @@ -192,6 +193,7 @@ static void establishShell(int argc, VALUE *argv, struct pty_info *info) { int i,master,slave; + rb_pid_t pid; char *p,*getenv(); struct passwd *pwent; VALUE v; @@ -218,13 +220,13 @@ establishShell(int argc, VALUE *argv, struct pty_info *info) getDevice(&master,&slave); info->thread = rb_thread_current(); - if((i = fork()) < 0) { + if ((pid = fork()) < 0) { close(master); close(slave); rb_sys_fail("fork failed"); } - if(i == 0) { /* child */ + if (pid == 0) { /* child */ /* * Set free from process group and controlling terminal */ @@ -282,7 +284,7 @@ establishShell(int argc, VALUE *argv, struct pty_info *info) close(slave); - info->child_pid = i; + info->child_pid = pid; info->fd = master; } @@ -420,7 +422,7 @@ pty_getpty(int argc, VALUE *argv, VALUE self) res = rb_ary_new2(3); rb_ary_store(res,0,(VALUE)rport); rb_ary_store(res,1,(VALUE)wport); - rb_ary_store(res,2,INT2FIX(info.child_pid)); + rb_ary_store(res,2,PIDT2NUM(info.child_pid)); thinfo.thread = rb_thread_create(pty_syswait, (void*)&info); thinfo.child_pid = info.child_pid; |