git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [GIT PATCH] I2C and W1 bugfixes for 2.6.12-rc2

From
LFLars Fenneberg <lf@elemental.net>
Date
Apr 19, 2005, 22:52 UTC
Message-ID
<20050419225232.GA8026@gimli.elemental.net>
In-Reply-To
<Pine.LNX.4.58.0504191449270.2274@ppc970.osdl.org>
Hi all!
Quoting Linus Torvalds (torvalds@osdl.org):
> And even the ones that use domainname tend to not have a fully qualified 
> DNS domain there. You need to use dnsdomainname to get that, and I don't 
> even know how to do it with standard libc.

I don't think getdomainname should be used at all in this case as it is the domain name used by NIS and it might be different from the DNS domain name in the FQDN associated with a given host. I just looked into the domainname manual page and it agrees with me:

 domainname,  nisdomainname,  ypdomainname  will  print the name of the
 system as returned by the getdomainname(2) function.  This is also known as
 the YP/NIS domain name of the system.

That's why it is set to "(none)" (i.e. its not setup at all) on most hosts because if they're not running NIS it's not really needed.

To get the FQDN which is what we want you'd have to use something like this:

#include <netdb.h> #include <unistd.h>

char *getfqdn(void)
{
        static char hostname[HOST_NAME_MAX + 1];
        struct hostent *hp;
        if (gethostname(hostname, sizeof(hostname)) < 0)
        {
                /* error handling */
        }
        if (!(hp = gethostbyname(hostname)))
        {
                /* just return the possibly unqualified hostname */
		return hostname;
        }
        return  hp->h_name;
}

Cheers, Lars.

-- 
Lars Fenneberg, lf@elemental.net (private), lf@mcs.de (work)
Previous: Jan-Benedict GlawNext: Petr Baudis
Message 16 of 30 in “I2C and W1 bugfixes for 2.6.12-rc2”
  1. I2C and W1 bugfixes for 2.6.12-rc2Greg KH, Apr 19, 2005
  2. Greg KHApr 19, 2005
  3. Linus TorvaldsApr 19, 2005
  4. Greg KHApr 19, 2005
  5. Linus TorvaldsApr 19, 2005
  6. Greg KHApr 19, 2005
  7. Linus TorvaldsApr 19, 2005
  8. Daniel JacobowitzApr 19, 2005
  9. Greg KHApr 19, 2005
  10. Kenneth JohanssonApr 19, 2005
  11. Linus TorvaldsApr 19, 2005
  12. Martin SchlemmerApr 19, 2005
  13. Linus TorvaldsApr 19, 2005
  14. Martin SchlemmerApr 19, 2005
  15. Jan-Benedict GlawApr 20, 2005
  16. Lars FennebergApr 19, 2005
  17. Petr BaudisApr 19, 2005
  18. Linus TorvaldsApr 19, 2005
  19. Steven ColeApr 19, 2005
  20. Petr BaudisApr 19, 2005
  21. Junio C HamanoApr 19, 2005
  22. Petr BaudisApr 19, 2005
  23. Linus TorvaldsApr 19, 2005
  24. Petr BaudisApr 19, 2005
  25. Steven ColeApr 19, 2005
  26. Petr BaudisApr 19, 2005
  27. Linus TorvaldsApr 19, 2005
  28. Steven ColeApr 19, 2005
  29. Zlatko CalusicApr 20, 2005
  30. Linus TorvaldsApr 20, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.