diff options
| author | Yasuhiro Matsumoto <[email protected]> | 2017-12-13 00:07:51 +0900 |
|---|---|---|
| committer | Yasuhiro Matsumoto <[email protected]> | 2017-12-13 00:07:51 +0900 |
| commit | 7ff907f6805007588775a5d872b4c6d9cb15746e (patch) | |
| tree | 3fb02c20ae72e43929ae4ed77a45692ab9c50f5f /mrbgems/mruby-io/test/mruby_io_test.c | |
| parent | f1ea7a31c091d3caa74ed0fe9f411ed17db4680f (diff) | |
| download | mruby-7ff907f6805007588775a5d872b4c6d9cb15746e.tar.gz mruby-7ff907f6805007588775a5d872b4c6d9cb15746e.zip | |
fix test
Diffstat (limited to 'mrbgems/mruby-io/test/mruby_io_test.c')
| -rw-r--r-- | mrbgems/mruby-io/test/mruby_io_test.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/mrbgems/mruby-io/test/mruby_io_test.c b/mrbgems/mruby-io/test/mruby_io_test.c index e0596e93d..53824522d 100644 --- a/mrbgems/mruby-io/test/mruby_io_test.c +++ b/mrbgems/mruby-io/test/mruby_io_test.c @@ -54,8 +54,8 @@ mrb_io_test_io_setup(mrb_state *mrb, mrb_value self) { char rfname[] = "tmp.mruby-io-test-r.XXXXXXXX"; char wfname[] = "tmp.mruby-io-test-w.XXXXXXXX"; - char symlinkname[] = "tmp.mruby-io-test.XXXXXXXX"; - char socketname[] = "/tmp/mruby-io-test.XXXXXXXX"; + char symlinkname[] = "tmp.mruby-io-test-l.XXXXXXXX"; + char socketname[] = "tmp.mruby-io-test-s.XXXXXXXX"; char msg[] = "mruby io test\n"; mode_t mask; int fd0, fd1; @@ -69,10 +69,14 @@ mrb_io_test_io_setup(mrb_state *mrb, mrb_value self) mask = umask(077); fd0 = mkstemp(rfname); fd1 = mkstemp(wfname); + if (fd0 == -1 || fd1 == -1) { + mrb_raise(mrb, E_RUNTIME_ERROR, "can't create temporary file"); + return mrb_nil_value(); + } #if !defined(_WIN32) && !defined(_WIN64) fd2 = mkstemp(symlinkname); fd3 = mkstemp(socketname); - if (fd0 == -1 || fd1 == -1 || fd2 == -1 || fd3 == -1) { + if (fd2 == -1 || fd3 == -1) { mrb_raise(mrb, E_RUNTIME_ERROR, "can't create temporary file"); return mrb_nil_value(); } |
