summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-09-07 16:45:06 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:05:31 -0500
commit307a45127b863836d4c301722ccc04ee94c457cb (patch)
treef94f02cb72a76e8ab41108901b1102b81edd08c3 /source4/lib
parent4a05c3406b512019ea43c653b994d938646b0f26 (diff)
downloadsamba-307a45127b863836d4c301722ccc04ee94c457cb.tar.gz
samba-307a45127b863836d4c301722ccc04ee94c457cb.tar.bz2
samba-307a45127b863836d4c301722ccc04ee94c457cb.zip
r25006: Use system constant.
(This used to be commit d9b2464598efe0f0cbecd4d8a90fbd137fad0daf)
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/util/util.c13
1 files changed, 6 insertions, 7 deletions
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;