From 9d49592f1459fc899633dba9d613f49f47fbcbc4 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Mon, 5 Feb 2018 06:23:33 -0700 Subject: [PATCH] Fix compilation with glibc where stdout is not constant. --- plugins/sudoers/cvtsudoers.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/sudoers/cvtsudoers.c b/plugins/sudoers/cvtsudoers.c index 5cf4dbcd1..0dbbcbb10 100644 --- a/plugins/sudoers/cvtsudoers.c +++ b/plugins/sudoers/cvtsudoers.c @@ -538,7 +538,7 @@ print_userspecs_sudoers(struct sudo_lbuf *lbuf) debug_return_bool(!sudo_lbuf_error(lbuf)); } -static FILE *output_fp = stdout; /* global for convert_sudoers_output */ +static FILE *output_fp; /* global for convert_sudoers_output */ static int convert_sudoers_output(const char *buf) @@ -556,7 +556,9 @@ convert_sudoers_sudoers(const char *output_file) struct sudo_lbuf lbuf; debug_decl(convert_sudoers_sudoers, SUDOERS_DEBUG_UTIL) - if (strcmp(output_file, "-") != 0) { + if (strcmp(output_file, "-") == 0) { + output_fp = stdout; + } else { if ((output_fp = fopen(output_file, "w")) == NULL) sudo_fatal(U_("unable to open %s"), output_file); } -- 2.40.0