git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lars Fenneberg <lf@elemental.net>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Greg KH <greg@kroah.com>, Git Mailing List <git@vger.kernel.org>
Subject: Re: [GIT PATCH] I2C and W1 bugfixes for 2.6.12-rc2
Date: Wed, 20 Apr 2005 00:52:32 +0200	[thread overview]
Message-ID: <20050419225232.GA8026@gimli.elemental.net> (raw)
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)

  parent reply	other threads:[~2005-04-19 22:48 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-19  4:39 [GIT PATCH] I2C and W1 bugfixes for 2.6.12-rc2 Greg KH
2005-04-19 18:58 ` Greg KH
2005-04-19 19:40   ` Linus Torvalds
2005-04-19 19:47     ` Greg KH
2005-04-19 20:20       ` Linus Torvalds
2005-04-19 21:40         ` Greg KH
2005-04-19 22:00           ` Linus Torvalds
2005-04-19 22:27             ` Daniel Jacobowitz
2005-04-19 22:33               ` Greg KH
2005-04-19 23:04                 ` Kenneth Johansson
2005-04-19 22:47               ` Linus Torvalds
2005-04-19 22:29             ` Martin Schlemmer
2005-04-19 22:43               ` Linus Torvalds
2005-04-19 23:11                 ` Martin Schlemmer
2005-04-20  0:01                 ` Jan-Benedict Glaw
2005-04-19 22:52             ` Lars Fenneberg [this message]
2005-04-19 22:39         ` Petr Baudis
2005-04-19 22:49           ` Linus Torvalds
2005-04-19 22:19     ` Steven Cole
2005-04-19 22:26       ` Petr Baudis
2005-04-19 22:45         ` Junio C Hamano
2005-04-19 22:58           ` Petr Baudis
2005-04-19 22:38       ` Linus Torvalds
2005-04-19 23:02         ` Petr Baudis
2005-04-19 23:04         ` Steven Cole
2005-04-19 23:16           ` Petr Baudis
2005-04-19 23:38           ` Linus Torvalds
2005-04-19 23:41             ` Steven Cole
2005-04-20 16:56         ` Zlatko Calusic
2005-04-20 17:15           ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050419225232.GA8026@gimli.elemental.net \
    --to=lf@elemental.net \
    --cc=git@vger.kernel.org \
    --cc=greg@kroah.com \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).