From 4dc9edfa55eb6dca86d66517d865ee09c7a6e34c Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Wed, 27 Jan 2021 14:51:56 +0100 Subject: [PATCH] swanctl: Don't print status message if nothing was loaded to stderr This is not an error (as reflected by the returned status code) so we should not print to stderr as output there might still be considered an error (or at least an audit-worthy event) by some scripts. --- src/swanctl/commands/load_authorities.c | 3 ++- src/swanctl/commands/load_conns.c | 2 +- src/swanctl/commands/load_pools.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/swanctl/commands/load_authorities.c b/src/swanctl/commands/load_authorities.c index 32f59b4b64..832509bf4d 100644 --- a/src/swanctl/commands/load_authorities.c +++ b/src/swanctl/commands/load_authorities.c @@ -292,7 +292,7 @@ int load_authorities_cfg(vici_conn_t *conn, command_format_options_t format, } if (found == 0) { - fprintf(stderr, "no authorities found, %u unloaded\n", unloaded); + printf("no authorities found, %u unloaded\n", unloaded); return 0; } if (loaded == found) @@ -301,6 +301,7 @@ int load_authorities_cfg(vici_conn_t *conn, command_format_options_t format, loaded, unloaded); return 0; } + fprintf(stderr, "loaded %u of %u authorities, %u failed to load, " "%u unloaded\n", loaded, found, found - loaded, unloaded); return EINVAL; diff --git a/src/swanctl/commands/load_conns.c b/src/swanctl/commands/load_conns.c index de23816fb4..47e434956b 100644 --- a/src/swanctl/commands/load_conns.c +++ b/src/swanctl/commands/load_conns.c @@ -410,7 +410,7 @@ int load_conns_cfg(vici_conn_t *conn, command_format_options_t format, } if (found == 0) { - fprintf(stderr, "no connections found, %u unloaded\n", unloaded); + printf("no connections found, %u unloaded\n", unloaded); return 0; } if (loaded == found) diff --git a/src/swanctl/commands/load_pools.c b/src/swanctl/commands/load_pools.c index 0ff6827e11..a3bbcfd3ae 100644 --- a/src/swanctl/commands/load_pools.c +++ b/src/swanctl/commands/load_pools.c @@ -233,7 +233,7 @@ int load_pools_cfg(vici_conn_t *conn, command_format_options_t format, } if (found == 0) { - fprintf(stderr, "no pools found, %u unloaded\n", unloaded); + printf("no pools found, %u unloaded\n", unloaded); return 0; } if (loaded == found) -- 2.47.2