Hi Theo, Theo de Raadt wrote on Thu, Feb 20, 2014 at 05:43:18PM -0700: > kettenis@ wrote:
>> Indeed. POSIX explicitly says: >> >> "No function in this volume of POSIX.1-2008 shall set errno to zero." >> >> The standard is slightly ambiguous on what getpwnam_r() should do, but >> the way I read it, it should not touch errno at all. So it should >> save errno at the start of the function, and restore it just before >> return. > That is the only sane approach. > > I would like to see a diff in which at least solves the non-YP cases. > The YP cases have other issues in other functions as well, that are > somewhat known.. I have sent two diffs in this thread doing that: * fix the return values http://marc.info/?l=openbsd-bugs&m=139282907725368 * and avoid clobbering errno in the non-YP case http://marc.info/?l=openbsd-bugs&m=139283817129480 So as soon as i get OKs for them, i can commit these two. Rushing a diff into the release to change the basic behaviour of getpwnam_r() - i.e. no longer setting errno even in the case of important failure - seems too dangerous and should be postponed until after release, i think. Yours, Ingo
