On Thu, Jan 29, 2009 at 06:06:10PM -0800, john.levon@xxxxxxx wrote: > @@ -1485,7 +1485,14 @@ char *virGetUserDirectory(virConnectPtr > return NULL; > } > > - if (getpwuid_r(uid, &pwbuf, strbuf, strbuflen, &pw) != 0) { > + /* > + * From the manpage (terrifying but true): > + * > + * ERRORS > + * 0 or ENOENT or ESRCH or EBADF or EPERM or ... > + * The given name or uid was not found. > + */ > + if (getpwuid_r(uid, &pwbuf, strbuf, strbuflen, &pw) != 0 || pw == NULL) > virReportSystemError(conn, errno, > _("Failed to find user record for uid '%d'"), > uid); Argh, I only read as far as "The getpwnam_r() and getpwuid_r() functions return zero on success. In case of error, and error number is returned" So it returns 0 on success, except when 0 means failure :-( ACK to your patch Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list