mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Handle failure of opening a null device
This issue is detected by Coverity Scan.
This commit is contained in:
parent
a191009a26
commit
dd4f128ac5
1 changed files with 7 additions and 3 deletions
|
@ -548,6 +548,13 @@ COMPILER_WARNING_IGNORED(-Wdeprecated-declarations)
|
||||||
static pid_t
|
static pid_t
|
||||||
start_process(const char *abspath, char *const *argv)
|
start_process(const char *abspath, char *const *argv)
|
||||||
{
|
{
|
||||||
|
// Not calling non-async-signal-safe functions between vfork
|
||||||
|
// and execv for safety
|
||||||
|
int dev_null = rb_cloexec_open(ruby_null_device, O_WRONLY, 0);
|
||||||
|
if (dev_null < 0) {
|
||||||
|
verbose(1, "MJIT: Failed to open a null device: %s", strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
if (mjit_opts.verbose >= 2) {
|
if (mjit_opts.verbose >= 2) {
|
||||||
const char *arg;
|
const char *arg;
|
||||||
fprintf(stderr, "Starting process: %s", abspath);
|
fprintf(stderr, "Starting process: %s", abspath);
|
||||||
|
@ -556,9 +563,6 @@ start_process(const char *abspath, char *const *argv)
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not calling non-async-signal-safe functions between vfork
|
|
||||||
// and execv for safety
|
|
||||||
int dev_null = rb_cloexec_open(ruby_null_device, O_WRONLY, 0);
|
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
extern HANDLE rb_w32_start_process(const char *abspath, char *const *argv, int out_fd);
|
extern HANDLE rb_w32_start_process(const char *abspath, char *const *argv, int out_fd);
|
||||||
|
|
Loading…
Reference in a new issue