On 07/13/2011 07:22 AM, Matthias Bolte wrote: > 2011/7/8 Eric Blake <[email protected]>: >> No need to repeat common code. >> >> * src/util/bridge.c (brInit): Use virSetCloseExec. >> (brSetInterfaceUp): Prefer unsigned flags. >> * src/uml/uml_driver.c (umlSetCloseExec): Delete. >> (umlStartVMDaemon): Use util version instead. >> --- >> >> v2: new patch
I've pushed 20-23.
>> -
>> - if (VIR_ALLOC(*ctlp) < 0) {
>> + if (fd < 0 ||
>> + virSetCloseExec(fd) < 0 ||
>> + VIR_ALLOC(*ctlp) < 0) {
>> VIR_FORCE_CLOSE(fd);
>> - return ENOMEM;
>> + return errno;
>> }
>
> Is it guaranteed that calloc will set ENOMEM, or do we need some
> gnulib module to guarantee this?
Well what do you know. We need to import 'calloc-posix' to get that to
happen on mingw. :)
>
>> (*ctlp)->fd = fd;
>> @@ -599,7 +590,7 @@ brSetInterfaceUp(brControl *ctl,
>> int up)
>> {
>> struct ifreq ifr;
>> - int flags;
>> + unsigned int flags;
>
> flags is used used with ifr.ifr_flags that is signed (actually it's a
> short). So I'd prefer renaming it to ifflags and keep it as int.
>
> ACK, with that questions/comments answered/addressed.
Here's what I squashed in before pushing.
diff --git i/bootstrap.conf w/bootstrap.conf
index 3c3d0e0..2fc457e 100644
--- i/bootstrap.conf
+++ w/bootstrap.conf
@@ -27,6 +27,7 @@ byteswap
c-ctype
c-strcase
c-strcasestr
+calloc-posix
canonicalize-lgpl
chown
close
diff --git i/src/util/bridge.c w/src/util/bridge.c
index a6b5768..0f4b639 100644
--- i/src/util/bridge.c
+++ w/src/util/bridge.c
@@ -590,7 +590,7 @@ brSetInterfaceUp(brControl *ctl,
int up)
{
struct ifreq ifr;
- unsigned int flags;
+ int ifflags;
if (!ctl || !ifname)
return EINVAL;
@@ -603,10 +603,10 @@ brSetInterfaceUp(brControl *ctl,
if (ioctl(ctl->fd, SIOCGIFFLAGS, &ifr) < 0)
return errno;
- flags = up ? (ifr.ifr_flags | IFF_UP) : (ifr.ifr_flags & ~IFF_UP);
+ ifflags = up ? (ifr.ifr_flags | IFF_UP) : (ifr.ifr_flags & ~IFF_UP);
- if (ifr.ifr_flags != flags) {
- ifr.ifr_flags = flags;
+ if (ifr.ifr_flags != ifflags) {
+ ifr.ifr_flags = ifflags;
if (ioctl(ctl->fd, SIOCSIFFLAGS, &ifr) < 0)
return errno;
--
Eric Blake [email protected] +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/libvir-list
