[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sethostname()
From: |
Adam Olsen |
Subject: |
Re: sethostname() |
Date: |
Sat, 3 Nov 2001 16:20:44 +0000 |
User-agent: |
Mutt/1.3.23i |
On Sat, Nov 03, 2001 at 08:04:53AM -0800, James Morrison wrote:
> It seems anytime I use sethostname(), in hostname or in my own
> program.
>
> int main() {
> sethostname("me",3);
> printf("%i:%s\n",errno,strerror(errno));
> }
>
> sethostname always returns bad file descriptor.
Are you checking the return value of sethostname? Most (all?)
functions don't set errno unless there's an error, so it'll contain
whatever it had before if you don't reset it to 0.
--
Adam Olsen, aka Rhamphoryncus