some systems don't have gethostname() ....

This commit is contained in:
Andrew Tridgell 2003-03-07 13:09:19 +01:00
parent 1edf1afde2
commit 6c0d53595c
4 changed files with 8 additions and 2 deletions

View File

@ -128,7 +128,9 @@ static const char *tmp_string(void)
if (!ret) {
char hostname[200];
strcpy(hostname, "unknown");
#if HAVE_GETHOSTNAME
gethostname(hostname, sizeof(hostname)-1);
#endif
hostname[sizeof(hostname)-1] = 0;
asprintf(&ret, "%s.%u", hostname, (unsigned)getpid());
}

View File

@ -16,6 +16,9 @@
*/
#undef HAVE_DIRENT_H
/* Define to 1 if you have the `gethostname' function. */
#undef HAVE_GETHOSTNAME
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H

3
configure vendored
View File

@ -3269,7 +3269,8 @@ done
for ac_func in realpath snprintf vsnprintf vasprintf asprintf mkstemp
for ac_func in realpath snprintf vsnprintf vasprintf asprintf mkstemp gethostname
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5

View File

@ -29,7 +29,7 @@ AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(ctype.h strings.h stdlib.h string.h)
AC_CHECK_FUNCS(realpath snprintf vsnprintf vasprintf asprintf mkstemp)
AC_CHECK_FUNCS(realpath snprintf vsnprintf vasprintf asprintf mkstemp gethostname)
AC_CACHE_CHECK([for compar_fn_t in stdlib.h],ccache_cv_COMPAR_FN_T, [
AC_TRY_COMPILE(