From: David Howells Date: Tue, 9 Jun 2020 13:24:55 +0000 (+0100) Subject: Fix a couple of bugs in kafs-dns X-Git-Tag: v0.5~7 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=7d5be1cff22d7089571f12f9a5c9e07e4d9fbefe;p=users%2Fdhowells%2Fkafs-client.git Fix a couple of bugs in kafs-dns Fix kafs-dns in the following ways: (1) The -V flag should not require an argument. (2) The srv=N callout info should check that N is supplied, else it will crash. Signed-off-by: David Howells --- diff --git a/src/dns_main.c b/src/dns_main.c index 2c1e5a3..0e1e62b 100644 --- a/src/dns_main.c +++ b/src/dns_main.c @@ -56,7 +56,6 @@ static const char key_type[] = "dns_resolver"; static const char afsdb_query_type[] = "afsdb:"; static key_serial_t key; static int debug_mode; -static bool one_addr_only = true; static unsigned int output_version = 0; /* @@ -197,9 +196,9 @@ static void parse_callout(char *options, struct kafs_lookup_context *ctx) } else if (strcmp(k, "ipv6") == 0) { ctx->want_ipv4_addrs = false; ctx->want_ipv6_addrs = true; - } else if (strcmp(k, "list") == 0) { - one_addr_only = false; } else if (strcmp(k, "srv") == 0) { + if (!val) + error("Option srv missing version"); output_version = atoi(val); } } while (*options); @@ -235,7 +234,7 @@ int main(int argc, char *argv[]) openlog(prog, 0, LOG_DAEMON); - while ((ret = getopt_long(argc, argv, "Dvc:N:o:V:", long_options, NULL)) != -1) { + while ((ret = getopt_long(argc, argv, "Dvc:N:o:V", long_options, NULL)) != -1) { switch (ret) { case 'c': if (filec >= 9) {