On Tue, Sep 13, 2011 at 02:30:27PM +0200, Leon Timmermans wrote: > On Mon, Sep 12, 2011 at 9:50 PM, Chris Adams <cmadams@hiwaay.net> wrote: > > > This is highly confusing, and there's really no reason to push this off > > on the people writing perl code. At a minimum, perl internally could do > > something like: > > > > if (setregid(gid,-1) == 0) > > errno = 0; > > > > (and that goes for all the setuid/setgid family of functions). > > That might piss off an equal number of users because $! gets > overwritten when they didn't expect it. The problem in perl is that $! is intimately bound to errno, and you have no business doing anything with errno except examining it immediately after a failed system call. IIRC, on some systems you cannot assign to errno anyway since it can be implemented as a macro expanding to a function. However, this is not to say that $! needs to remain so intimately bound to errno. It's easy to make an argument that $! should reflect the return status of the Perl function call, and not retain the C semantics as Jan described. It's somewhat less easy to argue against that. If we do make such a change then it might also be worth considering the option of throwing exceptions on failure too. -- Paul Johnson - paul@pjcj.net http://www.pjcj.netThread Previous | Thread Next