diff options
author | Lukas Slebodnik <lslebodn@redhat.com> | 2014-05-31 19:06:56 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2014-06-03 14:36:42 +0200 |
commit | bf6f1b3d49e17b1adf0448c0b06e94b1e52ddffd (patch) | |
tree | d192dbd41bcdf2ed2fbab20c9ec2934c56e4d9f6 /src/resolv | |
parent | cf901f549abe18f32562cbe1ef7a1ef258edab1a (diff) | |
download | sssd-bf6f1b3d49e17b1adf0448c0b06e94b1e52ddffd.tar.gz sssd-bf6f1b3d49e17b1adf0448c0b06e94b1e52ddffd.tar.xz sssd-bf6f1b3d49e17b1adf0448c0b06e94b1e52ddffd.zip |
Unify usage of function gethostname
man gethostanme says:
NOTES
SUSv2 guarantees that "Host names are limited to 255 bytes".
POSIX.1-2001 guarantees that "Host names (not including the terminating
null byte) are limited to HOST_NAME_MAX bytes". On Linux,
HOST_NAME_MAX is defined with the value 64, which has been the limit
since Linux 1.0 (earlier kernels imposed a limit of 8 bytes).
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
Diffstat (limited to 'src/resolv')
-rw-r--r-- | src/resolv/async_resolv_utils.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/resolv/async_resolv_utils.c b/src/resolv/async_resolv_utils.c index b24ae603f..c5ae5f9d4 100644 --- a/src/resolv/async_resolv_utils.c +++ b/src/resolv/async_resolv_utils.c @@ -44,7 +44,7 @@ resolv_get_domain_send(TALLOC_CTX *mem_ctx, struct resolv_get_domain_state *state = NULL; struct tevent_req *req = NULL; struct tevent_req *subreq = NULL; - char system_hostname[HOST_NAME_MAX]; + char system_hostname[HOST_NAME_MAX + 1]; errno_t ret; req = tevent_req_create(mem_ctx, &state, @@ -63,7 +63,7 @@ resolv_get_domain_send(TALLOC_CTX *mem_ctx, ret, strerror(ret)); goto immediately; } - system_hostname[HOST_NAME_MAX-1] = '\0'; + system_hostname[HOST_NAME_MAX] = '\0'; hostname = system_hostname; } |