]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
gssd: gethostname(3) returns zero or -1, not an errno
authorChuck Lever <chuck.lever@oracle.com>
Sat, 23 Mar 2013 12:13:22 +0000 (08:13 -0400)
committerSteve Dickson <steved@redhat.com>
Mon, 25 Mar 2013 14:09:11 +0000 (10:09 -0400)
According to "man gethostname," gssd is handling the return value of
gethostname(3) incorrectly.  It looks like other gethostname(3) call
sites in nfs-utils are already correct.

Acked-by: J. Bruce Fields <bfields@fieldses.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
utils/gssd/krb5_util.c

index 4df840e17723518417f3d23c557493884dc4defa..20b55b37c0f38405794be18f4bebd8ac089dccd2 100644 (file)
@@ -810,8 +810,8 @@ find_keytab_entry(krb5_context context, krb5_keytab kt, const char *tgtname,
                goto out;
 
        /* Get full local hostname */
-       retval = gethostname(myhostname, sizeof(myhostname));
-       if (retval) {
+       if (gethostname(myhostname, sizeof(myhostname)) == -1) {
+               retval = errno;
                k5err = gssd_k5_err_msg(context, retval);
                printerr(1, "%s while getting local hostname\n", k5err);
                goto out;