From 307a45127b863836d4c301722ccc04ee94c457cb Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 7 Sep 2007 16:45:06 +0000 Subject: r25006: Use system constant. (This used to be commit d9b2464598efe0f0cbecd4d8a90fbd137fad0daf) --- source4/lib/util/util.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'source4') diff --git a/source4/lib/util/util.c b/source4/lib/util/util.c index aa7a571585..624315f99e 100644 --- a/source4/lib/util/util.c +++ b/source4/lib/util/util.c @@ -190,28 +190,27 @@ _PUBLIC_ void msleep(unsigned int t) Get my own name, return in malloc'ed storage. **/ -_PUBLIC_ char* get_myname(void) +_PUBLIC_ char *get_myname(void) { char *hostname; - const int host_name_max = 255; char *p; - hostname = malloc(host_name_max+1); + hostname = (char *)malloc(MAXHOSTNAMELEN+1); *hostname = 0; /* get my host name */ - if (gethostname(hostname, host_name_max+1) == -1) { + if (gethostname(hostname, MAXHOSTNAMELEN+1) == -1) { DEBUG(0,("gethostname failed\n")); return NULL; } /* Ensure null termination. */ - hostname[host_name_max] = '\0'; + hostname[MAXHOSTNAMELEN] = '\0'; /* split off any parts after an initial . */ - p = strchr(hostname,'.'); + p = strchr(hostname, '.'); - if (p) + if (p != NULL) *p = 0; return hostname; -- cgit