[libvirt] [PATCHv2] virsh: fix keepalive error msg, man page update

resolves https://bugzilla.redhat.com/show_bug.cgi?id=1132305 --- tools/virsh.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index 30a84c1..713c9a5 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -3470,18 +3470,32 @@ vshParseArgv(vshControl *ctl, int argc, char **argv) exit(EXIT_SUCCESS); break; case 'k': - if (virStrToLong_i(optarg, NULL, 0, &keepalive) < 0 || - keepalive < 0) { - vshError(ctl, _("option %s requires a positive numeric argument"), + if (virStrToLong_i(optarg, NULL, 0, &keepalive) < 0) { + vshError(ctl, + _("Invalid value for option %s"), + longindex == -1 ? "-k" : "--keepalive-interval"); + exit(EXIT_FAILURE); + } + + if (keepalive < 0) { + vshError(ctl, + _("option %s requires a positive integer argument"), longindex == -1 ? "-k" : "--keepalive-interval"); exit(EXIT_FAILURE); } ctl->keepalive_interval = keepalive; break; case 'K': - if (virStrToLong_i(optarg, NULL, 0, &keepalive) < 0 || - keepalive < 0) { - vshError(ctl, _("option %s requires a positive numeric argument"), + if (virStrToLong_i(optarg, NULL, 0, &keepalive) < 0) { + vshError(ctl, + _("Invalid value for option %s"), + longindex == -1 ? "-K" : "--keepalive-count"); + exit(EXIT_FAILURE); + } + + if (keepalive < 0) { + vshError(ctl, + _("option %s requires a positive integer argument"), longindex == -1 ? "-K" : "--keepalive-count"); exit(EXIT_FAILURE); } -- 1.9.3

On 08/27/2014 08:20 AM, Erik Skultety wrote:
resolves https://bugzilla.redhat.com/show_bug.cgi?id=1132305
Please include a short summary of the BZ in the commit message, so a year from now, we don't have to chase the URL to find out why. The subject line is out of date, now that you dropped man page changes. ACK to the patch, though, so I'll push once I amend the subject line. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

Thank you for review. Sure, you're right, I'll definitely follow your advice next time. Erik On 08/27/2014 05:03 PM, Eric Blake wrote:
On 08/27/2014 08:20 AM, Erik Skultety wrote:
resolves https://bugzilla.redhat.com/show_bug.cgi?id=1132305
Please include a short summary of the BZ in the commit message, so a year from now, we don't have to chase the URL to find out why.
The subject line is out of date, now that you dropped man page changes.
ACK to the patch, though, so I'll push once I amend the subject line.
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
participants (2)
-
Eric Blake
-
Erik Skultety