diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-04-28 22:33:32 +0900 |
|---|---|---|
| committer | Hiroshi Mimaki <[email protected]> | 2020-05-07 09:36:43 +0900 |
| commit | b652a4ff1426d8832f2678e7a00de43b3b0aea4c (patch) | |
| tree | d30925f4d5411c9ba63005d21e01611f2e9b7d9f | |
| parent | 7dc0fe66c7d0356211d48076e22028987bbbc0a9 (diff) | |
| download | mruby-b652a4ff1426d8832f2678e7a00de43b3b0aea4c.tar.gz mruby-b652a4ff1426d8832f2678e7a00de43b3b0aea4c.zip | |
Fixed wrong condition in #4981.
| -rw-r--r-- | mrbgems/mruby-io/test/mruby_io_test.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/mrbgems/mruby-io/test/mruby_io_test.c b/mrbgems/mruby-io/test/mruby_io_test.c index e023b1904..7165d09cc 100644 --- a/mrbgems/mruby-io/test/mruby_io_test.c +++ b/mrbgems/mruby-io/test/mruby_io_test.c @@ -73,7 +73,7 @@ int socket_available_p; #if !defined(_WIN32) && !defined(_WIN64) static int mrb_io_socket_available() { - int fd, retval = 1; + int fd, retval = 0; struct sockaddr_un sun0; char socketname[] = "tmp.mruby-io-socket-ok.XXXXXXXX"; if (!(fd = mkstemp(socketname))) { @@ -87,11 +87,10 @@ static int mrb_io_socket_available() } sun0.sun_family = AF_UNIX; strncpy(sun0.sun_path, socketname, sizeof(sun0.sun_path)); - if (bind(fd, (struct sockaddr *)&sun0, sizeof(sun0)) == -1) { - retval = 0; + if (bind(fd, (struct sockaddr *)&sun0, sizeof(sun0)) == 0) { + retval = 1; } sock_test_out: - retval = 0; unlink(socketname); close(fd); return retval; |
