[libvirt] [PATCH 01/11] bhyve: stop using private gnulib _getopt_internal_r func

Ján Tomko jtomko at redhat.com
Thu Oct 3 16:09:52 UTC 2019


On Thu, Oct 03, 2019 at 02:53:08PM +0100, Daniel P. Berrangé wrote:
>The _getopt_internal_r func is not intended for public use, it is an
>internal function shared between the gnulib getopt and argp modules.
>
>Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
>---
> src/bhyve/bhyve_parse_command.c | 88 +++++++++++++++++----------------
> 1 file changed, 46 insertions(+), 42 deletions(-)
>
>diff --git a/src/bhyve/bhyve_parse_command.c b/src/bhyve/bhyve_parse_command.c
>index 7d460e9824..0bfe17c08c 100644
>--- a/src/bhyve/bhyve_parse_command.c
>+++ b/src/bhyve/bhyve_parse_command.c
>@@ -23,7 +23,6 @@
>
> #include <config.h>
> #include <libutil.h>
>-#include <getopt_int.h>
>
> #include "bhyve_capabilities.h"
> #include "bhyve_command.h"
>@@ -633,6 +632,14 @@ bhyveParseBhyvePCIArg(virDomainDefPtr def,
>     return -1;
> }
>
>+#define CONSUME_ARG(var) \
>+    if ((opti + 1) == argc) { \
>+        virReportError(VIR_ERR_INVALID_ARG, "Missing argument for '%s'", \
>+                       argv[opti]); \

src/bhyve/bhyve_parse_command.c:637:        virReportError(VIR_ERR_INVALID_ARG, "Missing argument for '%s'", \
maint.mk: found unmarked diagnostic(s)

>+        goto error; \
>+    } \
>+    var = argv[++opti]
>+
> /*
>  * Parse the /usr/sbin/bhyve command line.
>  */
>@@ -815,12 +825,7 @@ bhyveParseBhyveLoadCommandLine(virDomainDefPtr def,
>         def->os.bootloaderArgs = virStringListJoin((const char**) &argv[1], " ");
>     }
>
>-    if (argc != parser->optind) {
>-        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
>-                       _("Failed to parse arguments for bhyveload command"));
>-        goto error;
>-    }
>-
>+    fprintf(stderr, "Ok %s  %s %d\n", def->name, argv[argc], argc);

Debugging leftovers

>     if (def->name == NULL) {
>         if (VIR_STRDUP(def->name, argv[argc]) < 0)
>             goto error;

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20191003/a1da91be/attachment-0001.sig>


More information about the libvir-list mailing list