Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.unix.programmer > #1057

Re: Unix Domain Socket

From Rainer Weikusat <rweikusat@mssgmbh.com>
Newsgroups comp.unix.programmer
Subject Re: Unix Domain Socket
Date 2011-08-04 12:15 +0100
Message-ID <87mxfpv34i.fsf@sapphire.mobileactivedefense.com> (permalink)
References <56566d5a-ab99-4729-b8b3-e9a294b38e0a@j14g2000prn.googlegroups.com> <j16fslU93oL1@news.in-ulm.de> <255d383e-a951-4c98-98e4-a6b10a3d0ebd@glegroupsg2000goo.googlegroups.com>

Show all headers | View raw


wy <warmyouth@gmail.com> writes:
> I do not konw why the reply i posted yesterday has not been appeared.
> So...Should I ask a question?
>
> why this example ends with:
>
> err = errno;
> close(fd);
> errno = err;
>
> Does it mean that function close(fd) has effect on errno, so err stores its value and back later?
> And if I do not back up the real value of errno, nothing will
> happen, right?

Actually, it has appeared and was answered. Here is the answer again:
The value of errno may be changed in the course of executing any
routine that's documented as using it to return error codes, even if
the routine itself didn't fail (although this is also possible). In
this case, the caller should see the errno value set by the routine
whose failure lead to entering the 'exit with error codepath' and not
some other, related or unrelated errno value set by a routine executed
'on the way out'. Because of this, the value is saved to a local
variable and then restored.

Back to comp.unix.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Unix Domain Socket noneinwind <warmyouth@gmail.com> - 2011-08-01 06:50 -0700
  Re: Unix Domain Socket Volker Birk <bumens@dingens.org> - 2011-08-01 15:14 +0000
    Re: Unix Domain Socket noneinwind <warmyouth@gmail.com> - 2011-08-02 05:44 -0700
      Re: Unix Domain Socket Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-08-02 14:21 +0100
    Re: Unix Domain Socket wy <warmyouth@gmail.com> - 2011-08-03 19:35 -0700
      Re: Unix Domain Socket Rainer Weikusat <rweikusat@mssgmbh.com> - 2011-08-04 12:15 +0100
  Re: Unix Domain Socket Nobody <nobody@nowhere.com> - 2011-08-02 03:52 +0100
    Re: Unix Domain Socket Nicolas George <nicolas$george@salle-s.org> - 2011-08-02 08:58 +0000
    Re: Unix Domain Socket Rainer Weikusat <rweikusat@mssgmbh.com> - 2011-08-02 12:21 +0100

csiph-web