From: Chuck Lever Date: Sat, 23 Mar 2013 12:13:22 +0000 (-0400) Subject: gssd: gethostname(3) returns zero or -1, not an errno X-Git-Tag: debian/1%1.2.8-1~11^2^2~22 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=128bca853fc6df20a87d4d3dfe12c1b77204d673;p=nfs-utils.git gssd: gethostname(3) returns zero or -1, not an errno 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 Signed-off-by: Chuck Lever Signed-off-by: Steve Dickson --- diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c index 4df840e..20b55b3 100644 --- a/utils/gssd/krb5_util.c +++ b/utils/gssd/krb5_util.c @@ -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;