From 6ce11bc44f5fe2344083a94175a1667ca02e016c Mon Sep 17 00:00:00 2001 From: Alvar Penning Date: Thu, 11 Dec 2025 10:53:07 +0100 Subject: lib/utils_cmd: Rename stdout, stderr in cmd_run_result On OpenBSD's "stdio.h", stdin, stdout, and stderr are not directly FILE*, but #defines. Thus, naming the output struct fields stdout and stderr resulted in compiler errors, after replacing the #define. https://codeberg.org/OpenBSD/src/src/commit/a762189c5efbb2811f3c853bc0e5578fd5fb919d/include/stdio.h#L75-L77 --- lib/utils_cmd.c | 12 ++++++------ lib/utils_cmd.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/utils_cmd.c b/lib/utils_cmd.c index 42c81793..23d42168 100644 --- a/lib/utils_cmd.c +++ b/lib/utils_cmd.c @@ -489,14 +489,14 @@ cmd_run_result cmd_run2(const char *cmd_string, int flags) { cmd_run_result result = { .cmd_error_code = 0, .error_code = 0, - .stderr = + .err = { .buf = NULL, .buflen = 0, .line = NULL, .lines = 0, }, - .stdout = + .out = { .buf = NULL, .buflen = 0, @@ -581,14 +581,14 @@ cmd_run_result cmd_run_array2(char *const *cmd, int flags) { cmd_run_result result = { .cmd_error_code = 0, .error_code = 0, - .stderr = + .err = { .buf = NULL, .buflen = 0, .line = NULL, .lines = 0, }, - .stdout = + .out = { .buf = NULL, .buflen = 0, @@ -610,9 +610,9 @@ cmd_run_result cmd_run_array2(char *const *cmd, int flags) { int pfd_err[2] = {cmd_open_result.stderr_pipe_fd[0], cmd_open_result.stderr_pipe_fd[1]}; int_cmd_fetch_output2 tmp_stdout = _cmd_fetch_output2(pfd_out[0], flags); - result.stdout = tmp_stdout.output_container; + result.out = tmp_stdout.output_container; int_cmd_fetch_output2 tmp_stderr = _cmd_fetch_output2(pfd_err[0], flags); - result.stderr = tmp_stderr.output_container; + result.err = tmp_stderr.output_container; result.cmd_error_code = _cmd_close(file_descriptor); return result; diff --git a/lib/utils_cmd.h b/lib/utils_cmd.h index d3a8f14f..04a624b8 100644 --- a/lib/utils_cmd.h +++ b/lib/utils_cmd.h @@ -24,8 +24,8 @@ int cmd_file_read(const char *, output *, int); typedef struct { int error_code; int cmd_error_code; - output stdout; - output stderr; + output out; + output err; } cmd_run_result; cmd_run_result cmd_run2(const char *cmd, int flags); cmd_run_result cmd_run_array2(char * const *cmd, int flags); -- cgit v1.2.3-74-g34f1