diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-05-22 07:38:50 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-05-22 07:38:50 +0000 |
commit | 64bffee8d630d2a18244cfa641bdbf3bc3958b7c (patch) | |
tree | 8f8aa9a42775fa07d46e34c310ca098345fc57f0 /ruby.c | |
parent | affa7430b70336b53cd496496d889c2544d41322 (diff) | |
download | ruby-64bffee8d630d2a18244cfa641bdbf3bc3958b7c.tar.gz |
* ruby.c (set_arg0): support RSTRING_LEN on HP-UX. a patch from
WATANABE Tetsuya <Tetsuya.WATANABE AT nifty.com>. [ruby-dev:30806]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12305 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r-- | ruby.c | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -1092,18 +1092,18 @@ set_arg0(VALUE val, ID id) s = RSTRING_PTR(val); i = RSTRING_LEN(val); #if defined(PSTAT_SETCMD) - if (i >= PST_CLEN) { - union pstun j; - j.pst_command = s; - i = PST_CLEN; - RSTRING_LEN(val) = i; - *(s + i) = '\0'; - pstat(PSTAT_SETCMD, j, PST_CLEN, 0, 0); + if (i > PST_CLEN) { + union pstun un; + char buf[PST_CLEN + 1]; /* PST_CLEN is 64 (HP-UX 11.23) */ + strncpy(buf, s, PST_CLEN); + buf[PST_CLEN] = '\0'; + un.pst_command = buf; + pstat(PSTAT_SETCMD, un, PST_CLEN, 0, 0); } else { - union pstun j; - j.pst_command = s; - pstat(PSTAT_SETCMD, j, i, 0, 0); + union pstun un; + un.pst_command = s; + pstat(PSTAT_SETCMD, un, i, 0, 0); } rb_progname = rb_tainted_str_new(s, i); #elif defined(HAVE_SETPROCTITLE) |