Replace get_myname() with the talloc version from v3-3-test
[jra/samba/.git] / source3 / lib / util.c
index 68d332243610d5308c4c314a66c1350797383ebb..6079e710633bdce131bf1c1c58fda13aa203958e 100644 (file)
@@ -1208,35 +1208,6 @@ void add_to_large_array(TALLOC_CTX *mem_ctx, size_t element_size,
        *array_size = -1;
 }
 
-/****************************************************************************
- Get my own name and IP.
-****************************************************************************/
-
-char *talloc_get_myname(TALLOC_CTX *ctx)
-{
-       char *p;
-       char hostname[HOST_NAME_MAX];
-
-       *hostname = 0;
-
-       /* get my host name */
-       if (gethostname(hostname, sizeof(hostname)) == -1) {
-               DEBUG(0,("gethostname failed\n"));
-               return False;
-       }
-
-       /* Ensure null termination. */
-       hostname[sizeof(hostname)-1] = '\0';
-
-       /* split off any parts after an initial . */
-       p = strchr_m(hostname,'.');
-       if (p) {
-               *p = 0;
-       }
-
-       return talloc_strdup(ctx, hostname);
-}
-
 /****************************************************************************
  Get my own domain name, or "" if we have none.
 ****************************************************************************/
@@ -2237,7 +2208,7 @@ char *myhostname(void)
        if (ret == NULL) {
                /* This is cached forever so
                 * use talloc_autofree_context() ctx. */
-               ret = talloc_get_myname(talloc_autofree_context());
+               ret = get_myname(talloc_autofree_context());
        }
        return ret;
 }