Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
e90ecff6
Commit
e90ecff6
authored
Jun 21, 2016
by
Tomoyuki Sahara
Committed by
GitHub
Jun 21, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #60 from drbrain/test_io_setup_failure
Test io setup failure
parents
2af2a4ff
11961b42
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
test/mruby_io_test.c
test/mruby_io_test.c
+5
-2
No files found.
test/mruby_io_test.c
View file @
e90ecff6
#include <sys/types.h>
#include <errno.h>
#if defined(_WIN32) || defined(_WIN64)
#include <winsock.h>
...
...
@@ -24,7 +25,7 @@ mrb_io_test_io_setup(mrb_state *mrb, mrb_value self)
char
rfname
[]
=
"tmp.mruby-io-test.XXXXXXXX"
;
char
wfname
[]
=
"tmp.mruby-io-test.XXXXXXXX"
;
char
symlinkname
[]
=
"tmp.mruby-io-test.XXXXXXXX"
;
char
socketname
[]
=
"
tmp.
mruby-io-test.XXXXXXXX"
;
char
socketname
[]
=
"
/tmp/
mruby-io-test.XXXXXXXX"
;
char
msg
[]
=
"mruby io test
\n
"
;
mode_t
mask
;
int
fd0
,
fd1
,
fd2
,
fd3
;
...
...
@@ -84,7 +85,9 @@ mrb_io_test_io_setup(mrb_state *mrb, mrb_value self)
sun0
.
sun_family
=
AF_UNIX
;
snprintf
(
sun0
.
sun_path
,
sizeof
(
sun0
.
sun_path
),
"%s"
,
socketname
);
if
(
bind
(
fd3
,
(
struct
sockaddr
*
)
&
sun0
,
sizeof
(
sun0
))
==
-
1
)
{
mrb_raise
(
mrb
,
E_RUNTIME_ERROR
,
"can't make a socket bi"
);
mrb_raisef
(
mrb
,
E_RUNTIME_ERROR
,
"can't bind AF_UNIX socket to %S: %S"
,
mrb_str_new_cstr
(
mrb
,
sun0
.
sun_path
),
mrb_fixnum_value
(
errno
));
}
close
(
fd3
);
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment