 
	
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 1/2] Make shutdown use strings instead of codes
 On Fri, 2005-08-05 at 11:53 -0700, Dan Smith wrote:
> This patch changes the shutdown driver and xend to use strings instead
> of codes for signaling a shutdown request.
Commenting on this:
+    unsigned int len;
+
+    str = (char *)xenbus_read("control", "shutdown", &len);
+
+    if (! len) {
         return;
-    };
+    }
xenbus_read will always nul-terminate the string it receives, and you
should *never* test len as an indication of error!
It should be:
        str = xenbus_read("control", "shutdown", NULL);
        if (IS_ERR(str))
                return;
Cheers!
Rusty.
-- 
A bad analogy is like a leaky screwdriver -- Richard Braakman
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
 
 | 
|  | Lists.xenproject.org is hosted with RackSpace, monitoring our |