diff options
-rw-r--r-- | Distrib/PortingIssues.mdwn | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/Distrib/PortingIssues.mdwn b/Distrib/PortingIssues.mdwn index 4b78748b..1f9def8c 100644 --- a/Distrib/PortingIssues.mdwn +++ b/Distrib/PortingIssues.mdwn @@ -65,24 +65,19 @@ Buggy code: Fixed code: - #ifndef MAXHOSTNAMELEN #include "xgethostname.h" - #endif ... - #ifdef MAXHOSTNAMELEN - char localhost[MAXHOSTNAMELEN]; - #else - char *localhost; - #endif - ... - #ifdef MAXHOSTNAMELEN - - gethostname(localhost, sizeof(localhost)); - #else localhost = xgethostname(); - #endif + if (! localhost) + { + perror ("xgethostname"); + return ERROR; + } + ... + /* use LOCALHOST. */ + free (localhost); ## <a name="NOFILE_tt_"> `NOFILE` </a> @@ -168,6 +163,10 @@ See [a simple fix for TIOCFLUSH in telnet](http://mail.gnu.org/archive/html/bug- ## <a name="ChangeLog"> ChangeLog </a> +-- [[Main/TWikiGuest]] - 13 Jan 2005 + +Fix xgethostname example. - Neal + -- [[Main/RobertMillan]] - 22 Jul 2002 Formatting and minor grammatical fixes. |