diff options
author | Robert Millan <zeratul2@wanadoo.es> | 2003-04-05 11:56:00 +0000 |
---|---|---|
committer | Robert Millan <zeratul2@wanadoo.es> | 2003-04-05 11:56:00 +0000 |
commit | e473c59c27c5cd6fec83340af541f243efd88e86 (patch) | |
tree | ba585a6c3870e43d603fdb780ea9ebf302d84b0a /Distrib | |
parent | 7b3b90a584497a16da565334f56d13942d114323 (diff) |
none
Diffstat (limited to 'Distrib')
-rw-r--r-- | Distrib/PortingIssues.mdwn | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Distrib/PortingIssues.mdwn b/Distrib/PortingIssues.mdwn index e6b48a32..1e360df6 100644 --- a/Distrib/PortingIssues.mdwn +++ b/Distrib/PortingIssues.mdwn @@ -72,6 +72,7 @@ Fixed code: #else char *localhost; #endif + ... #ifdef MAXHOSTNAMELEN gethostname(localhost, sizeof(localhost)); @@ -159,6 +160,24 @@ and pass its address to `ioctl`: See [a simple fix for TIOCFLUSH in telnet](http://mail.gnu.org/archive/html/bug-inetutils/2001-08/msg00015.html). +## <a name="Uncompliant_use_of_sockaddr_un"> Uncompliant use of sockaddr\_un </a> + +The following declaration: sockaddr\_un sun = \{ AF\_UNIX, "" \}; won't work on GNU/Hurd. The Glibc API requires that the second parameter of a sockaddr\_un struct is a char (or a string of chars), but NOT a pointer to a string of chars. Glibc wants a non-nul-terminated 108 string of chars there, so we have to copy them directly into the sun\_path address. An example: + + #if defined(__GLIBC__) + sockaddr_un sun; + /* AF_LOCAL is the canonical flag in Glibc */ + sun.sun_family = AF_LOCAL; + /* copy the string into sun_path and fill it with nul chars + untill it reaches 108 bytes */ + strncpy (sun.sun_path, "something", 108); + #else + /* AF_UNIX used for compatibility reasons */ + sockaddr_un sun = { AF_UNIX, "something" }; + #endif + +NOTE: the current API is subject to change, see the notes in Glibc's docs ("info libc" and search for sockaddr\_un) and Debian bug #187391 + ---- ## <a name="ChangeLog"> ChangeLog </a> |