|
|
|
|
|
|
|
|
|
|
xen-devel
Re: [Xen-devel] [PATCH] xc: deal with xen/evtchn and xen/gntdev device n
On Fri, May 28, 2010 at 06:08:27PM -0700, Jeremy Fitzhardinge wrote:
> + if (asprintf(&devname, "xen!%s", dev) == 0)
> + if (asprintf(&devpath, "%s/%s", DEVXEN, dev) == 0)
asprintf is a glibc extension. Is it really necessary to support long
device names for fun or would some 64 byte on the stack be enough?
> + devnum = xc_find_device_number(dev);
> + if (devnum == -1)
> + devnum = xc_find_device_number(devname);
Checks should always go from the special ("xen!...") to the gerneral.
Also the device is dev_t, not integer.
> + /*
> + * If we know what the correct device is and the path doesn't
> + * exist or isn't a device, then remove it so we can create the
> + * device.
> + */
> + if (devnum != -1 &&
> + (stat(devpath, &st) != 0 || !S_ISCHR(st.st_mode))) {
Why should it exist and be something else then a character device? The
admin is free to break the system as she likes.
> + fd = open(devpath, O_RDWR);
Whitespace.
Bastian
--
... bacteriological warfare ... hard to believe we were once foolish
enough to play around with that.
-- McCoy, "The Omega Glory", stardate unknown
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
|
|
|
|