[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] inet_listen_opts: add error checking
From: |
Gerd Hoffmann |
Subject: |
Re: [Qemu-devel] [PATCH] inet_listen_opts: add error checking |
Date: |
Thu, 22 May 2014 07:43:39 +0200 |
> > /* lookup */
> > - if (port_offset)
> > - snprintf(port, sizeof(port), "%d", atoi(port) + port_offset);
> > + if (port_offset) {
> > + unsigned long long baseport;
>
> unsigned long long is not necessary, unsigned long is enough.
>
> > + if (parse_uint_full(port, &baseport, 10) < 0) {
parse_uint_full prototype uses "unsigned long long". And on 32bit
machines it actually is a difference (long long is 64bit integer whereas
long is 32bit only).
> > + error_setg(errp, "can't convert to a number: %s", port);
> > + return -1;
> > + }
> > + if (base_port > 65535 ||
>
> base_port is undeclared.
Oops, I'll fix.
cheers,
Gerd