diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-08-10 04:48:10 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-08-10 04:48:10 +0000 |
commit | 244bf0adc75aa73fb30ab2876ebcb90db9ec172e (patch) | |
tree | 464e9d2ca7bdddd6976253004734d95511fb72ae /goruby.c | |
parent | ac574fe862ecadb1d81e66eaee5cb15e45720a3c (diff) |
goruby.c: suppress warning
* goruby.c (goruby_options): check the result of `write(2)` to
suppress unused-result warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'goruby.c')
-rw-r--r-- | goruby.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -32,12 +32,14 @@ goruby_options(int argc, char **argv) void *ret; if ((isatty(0) && isatty(1) && isatty(2)) && (pipe(rw) == 0)) { + ssize_t n; infd = dup(0); + if (infd < 0) return NULL; dup2(rw[0], 0); close(rw[0]); - write(rw[1], cmd, sizeof(cmd) - 1); + n = write(rw[1], cmd, sizeof(cmd) - 1); close(rw[1]); - ret = ruby_options(argc, argv); + ret = n > 0 ? ruby_options(argc, argv) : NULL; dup2(infd, 0); close(infd); return ret; |