2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00

fix: usr: Remove extra newline from yaml output

I split this into two commits, one for the actual newline removal, and one for issues I found, ruining the yaml output when some errors were outputted.

Closes: #4772

Merge branch 'yaml-indent' into 'main'

Closes #4772

See merge request isc-projects/bind9!9112
This commit is contained in:
Mark Andrews
2024-08-05 03:36:41 +00:00
3 changed files with 9 additions and 15 deletions

View File

@@ -748,8 +748,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
char *hash; char *hash;
int pf; int pf;
printf("-\n"); printf("- type: MESSAGE\n");
printf(" type: MESSAGE\n");
printf(" message:\n"); printf(" message:\n");
if (isquery) { if (isquery) {
@@ -3306,8 +3305,7 @@ dig_error(const char *format, ...) {
va_list args; va_list args;
if (yaml) { if (yaml) {
printf("-\n"); printf("- type: DIG_ERROR\n");
printf(" type: DIG_ERROR\n");
/* /*
* Print an indent before a literal block quote. * Print an indent before a literal block quote.
@@ -3324,10 +3322,7 @@ dig_error(const char *format, ...) {
va_start(args, format); va_start(args, format);
vprintf(format, args); vprintf(format, args);
va_end(args); va_end(args);
printf("\n"); /* We get the error without a newline */
if (!yaml) {
printf("\n");
}
} }
static void static void

View File

@@ -3231,7 +3231,7 @@ udp_ready(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) {
start_udp(next); start_udp(next);
check_if_done(); check_if_done();
} else { } else {
dighost_error("no servers could be reached\n"); dighost_error("no servers could be reached");
clear_current_lookup(); clear_current_lookup();
} }
@@ -3423,10 +3423,10 @@ force_next(dig_query_t *query) {
isc_netaddr_fromsockaddr(&netaddr, &query->sockaddr); isc_netaddr_fromsockaddr(&netaddr, &query->sockaddr);
isc_netaddr_format(&netaddr, buf, sizeof(buf)); isc_netaddr_format(&netaddr, buf, sizeof(buf));
dighost_error("no response from %s\n", buf); dighost_error("no response from %s", buf);
} else { } else {
printf("%s", l->cmdline); printf("%s", l->cmdline);
dighost_error("no servers could be reached\n"); dighost_error("no servers could be reached");
} }
if (exitcode < 9) { if (exitcode < 9) {
@@ -3650,7 +3650,7 @@ tcp_connected(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) {
start_tcp(next); start_tcp(next);
check_if_done(); check_if_done();
} else { } else {
dighost_error("no servers could be reached\n"); dighost_error("no servers could be reached");
clear_current_lookup(); clear_current_lookup();
} }
@@ -4103,7 +4103,7 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
* and cancel the lookup. * and cancel the lookup.
*/ */
printf("%s", l->cmdline); printf("%s", l->cmdline);
dighost_error("no servers could be reached\n"); dighost_error("no servers could be reached");
if (exitcode < 9) { if (exitcode < 9) {
exitcode = 9; exitcode = 9;

View File

@@ -297,8 +297,7 @@ recvresponse(void *arg) {
char *hash; char *hash;
int pf; int pf;
printf("-\n"); printf("- type: MESSAGE\n");
printf(" type: MESSAGE\n");
printf(" message:\n"); printf(" message:\n");
if (((response->flags & DNS_MESSAGEFLAG_RD) != 0) && if (((response->flags & DNS_MESSAGEFLAG_RD) != 0) &&