Author: jelmer Date: 2007-09-07 16:45:06 +0000 (Fri, 07 Sep 2007) New Revision: 25006
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25006 Log: Use system constant. Modified: branches/SAMBA_4_0/ branches/SAMBA_4_0/source/lib/util/util.c Changeset: Property changes on: branches/SAMBA_4_0 ___________________________________________________________________ Name: bzr:revision-info ...skipped... Name: bzr:revision-id:v3-trunk0 ...skipped... Modified: branches/SAMBA_4_0/source/lib/util/util.c =================================================================== --- branches/SAMBA_4_0/source/lib/util/util.c 2007-09-07 16:30:06 UTC (rev 25005) +++ branches/SAMBA_4_0/source/lib/util/util.c 2007-09-07 16:45:06 UTC (rev 25006) @@ -190,28 +190,27 @@ 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;