On 04/20/2014 05:53 AM, Natanael Copa wrote:
> This makes sure that errno is reset before readdir is called, even if
> the loop does a 'continue'.
> 
> This fixes issue with musl libc which sets errno on sscanf. The
> following 'continue' makes the errno be set before calling readdir.
> 
> Signed-off-by: Natanael Copa <nc...@alpinelinux.org>
> ---
>  src/nodeinfo.c | 29 ++++++++---------------------
>  1 file changed, 8 insertions(+), 21 deletions(-)

> @@ -452,8 +453,7 @@ virNodeParseNode(const char *node,
>  
>      /* enumerate sockets in the node */
>      CPU_ZERO(&sock_map);
> -    errno = 0;
> -    while ((cpudirent = readdir(cpudir))) {
> +    while ((direrr = virDirRead(cpudir, &cpudirent, node)) == 0) {

Depends on whether we tweak return semantics of 0 vs 1 in patch 1.  But
modulo that design decision (anyone else with an opinion?) the
conversion is sane.  Are you planning on filling out the series to
include all other clients of readdir()?

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to