ruby.c: suppress warnings
* ruby.c (loadopen_func): suppress a warning, unused function. * ruby.c (open_load_file): suppress warnings, results of close(2). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
50024f9da6
commit
d5cb997f18
10
ruby.c
10
ruby.c
@ -1726,6 +1726,7 @@ load_file_internal(VALUE argp_v)
|
|||||||
return (VALUE)tree;
|
return (VALUE)tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef S_ISFIFO
|
||||||
static void *
|
static void *
|
||||||
loadopen_func(void *arg)
|
loadopen_func(void *arg)
|
||||||
{
|
{
|
||||||
@ -1736,6 +1737,7 @@ loadopen_func(void *arg)
|
|||||||
|
|
||||||
return (void *)(VALUE)fd;
|
return (void *)(VALUE)fd;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
open_load_file(VALUE fname_v, int *xflag)
|
open_load_file(VALUE fname_v, int *xflag)
|
||||||
@ -1777,7 +1779,7 @@ open_load_file(VALUE fname_v, int *xflag)
|
|||||||
/* disabling O_NONBLOCK */
|
/* disabling O_NONBLOCK */
|
||||||
if (fcntl(fd, F_SETFL, 0) < 0) {
|
if (fcntl(fd, F_SETFL, 0) < 0) {
|
||||||
e = errno;
|
e = errno;
|
||||||
close(fd);
|
(void)close(fd);
|
||||||
rb_load_fail(fname_v, strerror(e));
|
rb_load_fail(fname_v, strerror(e));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1787,12 +1789,12 @@ open_load_file(VALUE fname_v, int *xflag)
|
|||||||
struct stat st;
|
struct stat st;
|
||||||
if (fstat(fd, &st) != 0) {
|
if (fstat(fd, &st) != 0) {
|
||||||
e = errno;
|
e = errno;
|
||||||
close(fd);
|
(void)close(fd);
|
||||||
rb_load_fail(fname_v, strerror(e));
|
rb_load_fail(fname_v, strerror(e));
|
||||||
}
|
}
|
||||||
if (S_ISFIFO(st.st_mode)) {
|
if (S_ISFIFO(st.st_mode)) {
|
||||||
/* We need to wait if FIFO is empty. So, let's reopen it. */
|
/* We need to wait if FIFO is empty. So, let's reopen it. */
|
||||||
close(fd);
|
(void)close(fd);
|
||||||
fd = (int)(VALUE)rb_thread_call_without_gvl(loadopen_func,
|
fd = (int)(VALUE)rb_thread_call_without_gvl(loadopen_func,
|
||||||
(void *)fname, RUBY_UBF_IO, 0);
|
(void *)fname, RUBY_UBF_IO, 0);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
@ -1801,7 +1803,7 @@ open_load_file(VALUE fname_v, int *xflag)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!ruby_is_fd_loadable(fd)) {
|
if (!ruby_is_fd_loadable(fd)) {
|
||||||
close(fd);
|
(void)close(fd);
|
||||||
rb_load_fail(fname_v, strerror(errno));
|
rb_load_fail(fname_v, strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user