Skip to content

Commit 2d159fb

Browse files
committed
Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1
1 parent b698c35 commit 2d159fb

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

debug.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ setup_debug_log_filter(void)
368368

369369
if (len >= MAX_DEBUG_LOG_FILTER_LEN) {
370370
fprintf(stderr, "too long: %s (max:%d)\n", str, MAX_DEBUG_LOG_FILTER_LEN - 1);
371-
exit(1);
371+
exit(EXIT_FAILURE);
372372
}
373373

374374
// body
@@ -396,7 +396,7 @@ setup_debug_log(void)
396396
debug_log.mem = (char *)malloc(MAX_DEBUG_LOG * MAX_DEBUG_LOG_MESSAGE_LEN);
397397
if (debug_log.mem == NULL) {
398398
fprintf(stderr, "setup_debug_log failed (can't allocate memory)\n");
399-
exit(1);
399+
exit(EXIT_FAILURE);
400400
}
401401
ruby_debug_log_mode |= ruby_debug_log_memory;
402402
}
@@ -424,7 +424,7 @@ setup_debug_log(void)
424424
break;
425425
default:
426426
fprintf(stderr, "can not parse RUBY_DEBUG_LOG filename: %s\n", log_config);
427-
exit(1);
427+
exit(EXIT_FAILURE);
428428
}
429429
}
430430
else {
@@ -433,13 +433,13 @@ setup_debug_log(void)
433433

434434
if (j >= DEBUG_LOG_MAX_PATH) {
435435
fprintf(stderr, "RUBY_DEBUG_LOG=%s is too long\n", log_config);
436-
exit(1);
436+
exit(EXIT_FAILURE);
437437
}
438438
}
439439

440440
if ((debug_log.output = fopen(debug_log.output_file, "w")) == NULL) {
441441
fprintf(stderr, "can not open %s for RUBY_DEBUG_LOG\n", log_config);
442-
exit(1);
442+
exit(EXIT_FAILURE);
443443
}
444444
setvbuf(debug_log.output, NULL, _IONBF, 0);
445445
}

gc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ ruby_modular_gc_init(void)
714714
break;
715715
default:
716716
fprintf(stderr, "Only alphanumeric, dash, and underscore is allowed in "RUBY_GC_LIBRARY"\n");
717-
exit(1);
717+
exit(EXIT_FAILURE);
718718
}
719719
}
720720

@@ -761,7 +761,7 @@ ruby_modular_gc_init(void)
761761
handle = dlopen(gc_so_path, RTLD_LAZY | RTLD_GLOBAL);
762762
if (!handle) {
763763
fprintf(stderr, "ruby_modular_gc_init: Shared library %s cannot be opened: %s\n", gc_so_path, dlerror());
764-
exit(1);
764+
exit(EXIT_FAILURE);
765765
}
766766

767767
gc_functions.modular_gc_loaded_p = true;
@@ -773,7 +773,7 @@ ruby_modular_gc_init(void)
773773
gc_functions.name = dlsym(handle, func_name); \
774774
if (!gc_functions.name) { \
775775
fprintf(stderr, "ruby_modular_gc_init: %s function not exported by library %s\n", func_name, gc_so_path); \
776-
exit(1); \
776+
exit(EXIT_FAILURE); \
777777
} \
778778
} \
779779
else { \

io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8079,7 +8079,7 @@ popen_finish(VALUE port, VALUE klass)
80798079
rb_protect(rb_yield, Qnil, NULL);
80808080
rb_io_flush(rb_ractor_stdout());
80818081
rb_io_flush(rb_ractor_stderr());
8082-
_exit(0);
8082+
_exit(EXIT_SUCCESS);
80838083
}
80848084
return Qnil;
80858085
}

0 commit comments

Comments
 (0)