Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/xen/xenbus Fix problem where devices with ID 0 were...



details:   https://anonhg.NetBSD.org/src/rev/4f588d47e9e9
branches:  trunk
changeset: 779641:4f588d47e9e9
user:      sborrill <sborrill%NetBSD.org@localhost>
date:      Thu Jun 07 14:05:13 2012 +0000

description:
Fix problem where devices with ID 0 were skipped as invalid as it didn't
distinguish between numerical zero and invalid numeric string.

diffstat:

 sys/arch/xen/xenbus/xenbus_probe.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r ec4d976b5c17 -r 4f588d47e9e9 sys/arch/xen/xenbus/xenbus_probe.c
--- a/sys/arch/xen/xenbus/xenbus_probe.c        Thu Jun 07 09:59:51 2012 +0000
+++ b/sys/arch/xen/xenbus/xenbus_probe.c        Thu Jun 07 14:05:13 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_probe.c,v 1.36 2012/06/05 10:58:56 sborrill Exp $ */
+/* $NetBSD: xenbus_probe.c,v 1.37 2012/06/07 14:05:13 sborrill Exp $ */
 /******************************************************************************
  * Talks to Xen Store to figure out what devices we have.
  *
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.36 2012/06/05 10:58:56 sborrill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.37 2012/06/07 14:05:13 sborrill Exp $");
 
 #if 0
 #define DPRINTK(fmt, args...) \
@@ -354,7 +354,11 @@
 
                /* Convert string values to numeric; skip invalid */
                for (i = 0; i < dir_n; i++) {
-                       id[i] = strtoul(dir[i], &ep, 10);
+                       /*
+                        * Add one to differentiate numerical zero from invalid
+                        * string. Has no effect on sort order.
+                        */
+                       id[i] = strtoul(dir[i], &ep, 10) + 1;
                        if (dir[i][0] == '\0' || *ep != '\0')
                                id[i] = 0;
                }



Home | Main Index | Thread Index | Old Index