mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-07-11 04:15:49 +00:00
virt-ssh-helper: Don't use optind
It's a getopt interface and we're not using getopt, at least directly, so even though it works relying on it feels wrong. GOption takes care of removing any trace of the arguments it consumes from argc and argv, leaving behind only non-option arguments, so we can just use those standard variables. Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
d804408ef9
commit
a4941a0c27
@ -395,12 +395,12 @@ int main(int argc, char **argv)
|
||||
/* Initialize the log system */
|
||||
virLogSetFromEnv();
|
||||
|
||||
if (optind != (argc - 1)) {
|
||||
if (argc != 2) {
|
||||
g_printerr("%s: expected a URI\n", argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
uri_str = argv[optind];
|
||||
uri_str = argv[1];
|
||||
VIR_DEBUG("Using URI %s", uri_str);
|
||||
|
||||
if (!(uri = virURIParse(uri_str))) {
|
||||
|
Loading…
Reference in New Issue
Block a user