Re: [PATCH 2/2] nodeinfo: use virDirRead API

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

 



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 <ncopa@xxxxxxxxxxxxxxx>
> ---
>  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@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[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]