Re: Virtual networking (not the rathole thread :-)

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

 



Hi Karel,

On Mon, 2007-01-29 at 09:27 +0100, Karel Zak wrote:
>  pedant's quick glance: ;-)
> 
> On Thu, Jan 25, 2007 at 03:52:03PM +0000, Mark McLoughlin wrote:
> > @@ -761,6 +813,61 @@ static int qemudParseXML(struct qemud_se
> >  }
> >  
> >  
> > +static char *
> > +qemudNetworkIfaceConnect(struct qemud_server *server,
> > +                         struct qemud_vm *vm,
> > +                         struct qemud_vm_net_def *net)
> > +{
> 
>  .....
> 
> > +
> > +    snprintf(tapfdstr, sizeof(tapfdstr), "tap,fd=%d,script=", tapfd);
> > +
> > +    return strdup(tapfdstr);
>          ^^^^^^^^^^^^^^^^^^^
>   where is allocation check?
> 
>        if ((p = strdup(tapfdstr)))
>            return p; 

	Very well spotted ... I've also moved the strdup() to before the tapfds
realloc() so as to not leave that in a weird state if the strdup()
fails.

> > +        if (net->type == QEMUD_NET_NETWORK) {
> > +            if (qemudBufferPrintf(&buf, "      <network name='%s", net->dst.network.name) < 0)
> > +                goto no_memory;
> > +
> > +            if (net->dst.network.tapifname[0] != '\0' &&
> > +                qemudBufferPrintf(&buf, " tapifname='%s'", net->dst.network.tapifname) < 0)
> > +                goto no_memory;
> > +
> > +            if (qemudBufferPrintf(&buf, "/>\n") < 0)
> > +                goto no_memory;
> > +        }
> > +
> >          if (qemudBufferPrintf(&buf, "    </interface>\n") < 0)
>                           ^^^^^^
> 
>   There is also BufferAdd() which is cheaper than Printf if you
>   needn't any string formatting.

	That's one for Dan ... notice the way it's not actually in my patch. I
did actually think the same thing myself at the time ... :-)

Thanks,
Mark.



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]