"Niels M�ller" wrote:
>
> Balazs Scheidler <[EMAIL PROTECTED]> writes:
>
> > Sent it in private again... Maybe a reply-to is missing ?
>
> I'd say NO. An occasional reply sent privately instead of publicly is
> a lot better than the other way round. And automatically setting
> Reply-To: to the list address is Evil, it breaks stuff for those using
> Reply-To for legitimate reasons, and it helps Stupid and Evil
> mailprograms, which lack the important Reply-to-sender/Reply-to-all
> distinction, survive.
>
> > This must be the problem. According to linux manpage:
> >
> > F_SETFL Set the descriptor's flags to the value specified
> > by arg. Only O_APPEND, O_NONBLOCK and O_ASYNC
> > may be set; the other flags are unaffected.
> >
> > So O_APPEND must be present here as well, this patch should fix the problem
> > (against lsh-000.2):
>
> I wrote the io_set_nonblocking before I found any use for O_APPEND... ;-/
>
> > --- io.c~ Sun Dec 12 20:32:03 1999
> > +++ io.c Sat Jan 8 14:15:46 2000
> > @@ -913,7 +913,7 @@
> >
> > void io_set_nonblocking(int fd)
> > {
> > - if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0)
> > + if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK) < 0)
> > fatal("io_set_nonblocking: fcntl() failed, %z", STRERROR(errno));
> > }
>
> I'm checking in a similar fix, which checks the return code from the
> inner fcntl as well.
I was just about ready to reply to Balazs stating that he would not
catch an error with the inner fcntl.
> As for io_set_close_on_exec, is the corresponding fix needed there? My
> man pages says that there is only one flag that can be set, and that
> all but the least significant bit is ignored. But perhaps stranger or
> future systems have more flags for F_GETFD/F_SETFD?
Regarding io_set_close_on_exec: Richard Stevens in Advanced UNIX
Programming states that most people just call fcnt with F_SETFD and
a hard-coded 1. He later warns, however, that prior to doing
F_SETFD or F_SETFL you should _always_ do an F_GETFD and F_GETFL
and then or your bit to whatever is returned.
I vote for the safe way of doing things. Shortcuts have a strange
way of biting you later - especially if you aren't 100% sure.
> /Niels