From 5fcb06f86e295a0ad5e9b0292cc299e22ff49534 Mon Sep 17 00:00:00 2001 From: Jaakko Heinonen Date: Thu, 23 Aug 2012 16:25:36 +0000 Subject: [PATCH] Check the return value of sbuf_finish(). --- sbin/camcontrol/camcontrol.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c index 0ffd10e7e23c..362bedd3ba7a 100644 --- a/sbin/camcontrol/camcontrol.c +++ b/sbin/camcontrol/camcontrol.c @@ -4758,7 +4758,10 @@ smpreportgeneral(struct cam_device *device, int argc, char **argv, smp_report_general_sbuf(response, sizeof(*response), sb); - sbuf_finish(sb); + if (sbuf_finish(sb) != 0) { + warnx("%s: sbuf_finish", __func__); + goto bailout; + } printf("%s", sbuf_data(sb)); @@ -5129,7 +5132,10 @@ smpmaninfo(struct cam_device *device, int argc, char **argv, smp_report_manuf_info_sbuf(&response, sizeof(response), sb); - sbuf_finish(sb); + if (sbuf_finish(sb) != 0) { + warnx("%s: sbuf_finish", __func__); + goto bailout; + } printf("%s", sbuf_data(sb));