summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2026-02-12 18:31:00 +0900
committerNobuyoshi Nakada <nobu.nakada@gmail.com>2026-02-12 19:17:44 +0900
commit2d159fbbb6e3a123654a6a60b12654eedfcefd9d (patch)
tree9ed80028d515eb8d388997e5dafec3dcff73953d
parentb698c35590671e2b6f5920ca01c83ec4ebea610b (diff)
Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1
-rw-r--r--debug.c10
-rw-r--r--gc.c6
-rw-r--r--io.c2
3 files changed, 9 insertions, 9 deletions
diff --git a/debug.c b/debug.c
index 1a2c27a5be..730f860e7a 100644
--- a/debug.c
+++ b/debug.c
@@ -368,7 +368,7 @@ setup_debug_log_filter(void)
if (len >= MAX_DEBUG_LOG_FILTER_LEN) {
fprintf(stderr, "too long: %s (max:%d)\n", str, MAX_DEBUG_LOG_FILTER_LEN - 1);
- exit(1);
+ exit(EXIT_FAILURE);
}
// body
@@ -396,7 +396,7 @@ setup_debug_log(void)
debug_log.mem = (char *)malloc(MAX_DEBUG_LOG * MAX_DEBUG_LOG_MESSAGE_LEN);
if (debug_log.mem == NULL) {
fprintf(stderr, "setup_debug_log failed (can't allocate memory)\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
ruby_debug_log_mode |= ruby_debug_log_memory;
}
@@ -424,7 +424,7 @@ setup_debug_log(void)
break;
default:
fprintf(stderr, "can not parse RUBY_DEBUG_LOG filename: %s\n", log_config);
- exit(1);
+ exit(EXIT_FAILURE);
}
}
else {
@@ -433,13 +433,13 @@ setup_debug_log(void)
if (j >= DEBUG_LOG_MAX_PATH) {
fprintf(stderr, "RUBY_DEBUG_LOG=%s is too long\n", log_config);
- exit(1);
+ exit(EXIT_FAILURE);
}
}
if ((debug_log.output = fopen(debug_log.output_file, "w")) == NULL) {
fprintf(stderr, "can not open %s for RUBY_DEBUG_LOG\n", log_config);
- exit(1);
+ exit(EXIT_FAILURE);
}
setvbuf(debug_log.output, NULL, _IONBF, 0);
}
diff --git a/gc.c b/gc.c
index 4e1bb39e21..c0f8eebbab 100644
--- a/gc.c
+++ b/gc.c
@@ -714,7 +714,7 @@ ruby_modular_gc_init(void)
break;
default:
fprintf(stderr, "Only alphanumeric, dash, and underscore is allowed in "RUBY_GC_LIBRARY"\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
}
@@ -761,7 +761,7 @@ ruby_modular_gc_init(void)
handle = dlopen(gc_so_path, RTLD_LAZY | RTLD_GLOBAL);
if (!handle) {
fprintf(stderr, "ruby_modular_gc_init: Shared library %s cannot be opened: %s\n", gc_so_path, dlerror());
- exit(1);
+ exit(EXIT_FAILURE);
}
gc_functions.modular_gc_loaded_p = true;
@@ -773,7 +773,7 @@ ruby_modular_gc_init(void)
gc_functions.name = dlsym(handle, func_name); \
if (!gc_functions.name) { \
fprintf(stderr, "ruby_modular_gc_init: %s function not exported by library %s\n", func_name, gc_so_path); \
- exit(1); \
+ exit(EXIT_FAILURE); \
} \
} \
else { \
diff --git a/io.c b/io.c
index cf95db70df..0ac78e96cc 100644
--- a/io.c
+++ b/io.c
@@ -8079,7 +8079,7 @@ popen_finish(VALUE port, VALUE klass)
rb_protect(rb_yield, Qnil, NULL);
rb_io_flush(rb_ractor_stdout());
rb_io_flush(rb_ractor_stderr());
- _exit(0);
+ _exit(EXIT_SUCCESS);
}
return Qnil;
}