diff options
| author | 2005-04-16 18:40:55 +0000 | |
|---|---|---|
| committer | 2005-04-16 18:40:55 +0000 | |
| commit | 3855601b3e31d88debdcfa828d3ea786be20a499 (patch) | |
| tree | 2a5474067c7b461dde2fa99cd14333b2b5b74523 /sys/dev/usb/usb_subr.c | |
| parent | Describe __syscall(2) in all its ugliness. ok jmc@ tom@ millert@ (diff) | |
| download | wireguard-openbsd-3855601b3e31d88debdcfa828d3ea786be20a499.tar.xz wireguard-openbsd-3855601b3e31d88debdcfa828d3ea786be20a499.zip | |
change usbd_printBCD() to return number of bytes really placed or 0, not
snprintf() style semantics [which people fail to grok]; ok otto
Diffstat (limited to 'sys/dev/usb/usb_subr.c')
| -rw-r--r-- | sys/dev/usb/usb_subr.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c index 9023bf131c5..727944cabde 100644 --- a/sys/dev/usb/usb_subr.c +++ b/sys/dev/usb/usb_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usb_subr.c,v 1.33 2005/03/13 02:54:04 pascoe Exp $ */ +/* $OpenBSD: usb_subr.c,v 1.34 2005/04/16 18:40:55 deraadt Exp $ */ /* $NetBSD: usb_subr.c,v 1.103 2003/01/10 11:19:13 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */ @@ -302,7 +302,14 @@ usbd_devinfo_vp(usbd_device_handle dev, char *v, char *p, int usedev) int usbd_printBCD(char *cp, size_t len, int bcd) { - return (snprintf(cp, len, "%x.%02x", bcd >> 8, bcd & 0xff)); + int l; + + l = snprintf(cp, len, "%x.%02x", bcd >> 8, bcd & 0xff); + if (l == -1 || len == 0) + return (0); + if (l >= len) + return len - 1; + return (l); } void |
