diff options
| author | Jérémie Koenig <jk@jk.fr.eu.org> | 2010-03-26 19:08:53 +0100 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-03-26 19:08:53 +0100 |
| commit | fbedacfc8caa1ec8f14e664a881cb0a93c8f8712 (patch) | |
| tree | 6c08780bbaad6320149930bdbcfbee5a2eed9f5d /libbb | |
| parent | 35fdb1bc9cb82fa5630c2d40ae49110ecd7c88ea (diff) | |
| download | busybox-w32-fbedacfc8caa1ec8f14e664a881cb0a93c8f8712.tar.gz busybox-w32-fbedacfc8caa1ec8f14e664a881cb0a93c8f8712.tar.bz2 busybox-w32-fbedacfc8caa1ec8f14e664a881cb0a93c8f8712.zip | |
Hurd compat fixes. Mostly dealing with absent PATH_MAX
Signed-off-by: Jérémie Koenig <jk@jk.fr.eu.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
| -rw-r--r-- | libbb/safe_gethostname.c | 6 | ||||
| -rw-r--r-- | libbb/xconnect.c | 10 | ||||
| -rw-r--r-- | libbb/xreadlink.c | 6 |
3 files changed, 17 insertions, 5 deletions
diff --git a/libbb/safe_gethostname.c b/libbb/safe_gethostname.c index 7407fb782..e93254b2b 100644 --- a/libbb/safe_gethostname.c +++ b/libbb/safe_gethostname.c | |||
| @@ -59,8 +59,12 @@ char* FAST_FUNC safe_gethostname(void) | |||
| 59 | */ | 59 | */ |
| 60 | char* FAST_FUNC safe_getdomainname(void) | 60 | char* FAST_FUNC safe_getdomainname(void) |
| 61 | { | 61 | { |
| 62 | /* The field domainname of struct utsname is Linux specific. */ | ||
| 63 | #if defined(__linux__) | ||
| 62 | struct utsname uts; | 64 | struct utsname uts; |
| 63 | |||
| 64 | uname(&uts); | 65 | uname(&uts); |
| 65 | return xstrndup(!uts.domainname[0] ? "?" : uts.domainname, sizeof(uts.domainname)); | 66 | return xstrndup(!uts.domainname[0] ? "?" : uts.domainname, sizeof(uts.domainname)); |
| 67 | #else | ||
| 68 | return xstrdup("?"); | ||
| 69 | #endif | ||
| 66 | } | 70 | } |
diff --git a/libbb/xconnect.c b/libbb/xconnect.c index 97751eb27..d8c8d02d5 100644 --- a/libbb/xconnect.c +++ b/libbb/xconnect.c | |||
| @@ -21,6 +21,8 @@ int FAST_FUNC setsockopt_broadcast(int fd) | |||
| 21 | { | 21 | { |
| 22 | return setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &const_int_1, sizeof(const_int_1)); | 22 | return setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &const_int_1, sizeof(const_int_1)); |
| 23 | } | 23 | } |
| 24 | |||
| 25 | #ifdef SO_BINDTODEVICE | ||
| 24 | int FAST_FUNC setsockopt_bindtodevice(int fd, const char *iface) | 26 | int FAST_FUNC setsockopt_bindtodevice(int fd, const char *iface) |
| 25 | { | 27 | { |
| 26 | int r; | 28 | int r; |
| @@ -36,6 +38,14 @@ int FAST_FUNC setsockopt_bindtodevice(int fd, const char *iface) | |||
| 36 | bb_perror_msg("can't bind to interface %s", iface); | 38 | bb_perror_msg("can't bind to interface %s", iface); |
| 37 | return r; | 39 | return r; |
| 38 | } | 40 | } |
| 41 | #else | ||
| 42 | int FAST_FUNC setsockopt_bindtodevice(int fd UNUSED_PARAM, | ||
| 43 | const char *iface UNUSED_PARAM) | ||
| 44 | { | ||
| 45 | bb_error_msg("SO_BINDTODEVICE is not supported on this system"); | ||
| 46 | return -1; | ||
| 47 | } | ||
| 48 | #endif | ||
| 39 | 49 | ||
| 40 | len_and_sockaddr* FAST_FUNC get_sock_lsa(int fd) | 50 | len_and_sockaddr* FAST_FUNC get_sock_lsa(int fd) |
| 41 | { | 51 | { |
diff --git a/libbb/xreadlink.c b/libbb/xreadlink.c index 8d232f16b..faa0e1646 100644 --- a/libbb/xreadlink.c +++ b/libbb/xreadlink.c | |||
| @@ -100,18 +100,16 @@ char* FAST_FUNC xmalloc_readlink_or_warn(const char *path) | |||
| 100 | return buf; | 100 | return buf; |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | /* UNUSED */ | ||
| 104 | #if 0 | ||
| 105 | char* FAST_FUNC xmalloc_realpath(const char *path) | 103 | char* FAST_FUNC xmalloc_realpath(const char *path) |
| 106 | { | 104 | { |
| 107 | #if defined(__GLIBC__) && !defined(__UCLIBC__) | 105 | #if defined(__GLIBC__) && !defined(__UCLIBC__) |
| 108 | /* glibc provides a non-standard extension */ | 106 | /* glibc provides a non-standard extension */ |
| 107 | /* new: POSIX.1-2008 specifies this behavior as well */ | ||
| 109 | return realpath(path, NULL); | 108 | return realpath(path, NULL); |
| 110 | #else | 109 | #else |
| 111 | char buf[PATH_MAX+1]; | 110 | char buf[PATH_MAX+1]; |
| 112 | 111 | ||
| 113 | /* on error returns NULL (xstrdup(NULL) ==NULL) */ | 112 | /* on error returns NULL (xstrdup(NULL) == NULL) */ |
| 114 | return xstrdup(realpath(path, buf)); | 113 | return xstrdup(realpath(path, buf)); |
| 115 | #endif | 114 | #endif |
| 116 | } | 115 | } |
| 117 | #endif | ||
