From 5d5031cc9373b8af6fb01bb2fa9839a4f5acb9f5 Mon Sep 17 00:00:00 2001 From: Antonio Huete Jimenez Date: Tue, 19 Apr 2011 20:58:07 +0200 Subject: [PATCH] hammer - Fix version output Do not try to display WIP version if there isn't one. --- sbin/hammer/cmd_version.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sbin/hammer/cmd_version.c b/sbin/hammer/cmd_version.c index 956e0f581d..5c1f9c950d 100644 --- a/sbin/hammer/cmd_version.c +++ b/sbin/hammer/cmd_version.c @@ -46,6 +46,7 @@ void hammer_cmd_get_version(char **av, int ac) { struct hammer_ioc_version version; + char wip[16]; int fd; if (ac != 1) @@ -66,9 +67,10 @@ hammer_cmd_get_version(char **av, int ac) fprintf(stderr, "hammer version ioctl: %s\n", strerror(errno)); exit(1); } - printf("min=%d wip=%d max=%d current=%d description=\"%s\"\n", + snprintf(wip, 16, "%d", version.wip_version); + printf("min=%d wip=%s max=%d current=%d description=\"%s\"\n", version.min_version, - version.wip_version, + (version.wip_version > version.max_version) ? "none" : wip, version.max_version, version.cur_version, version.description -- 2.11.4.GIT