From 128bca853fc6df20a87d4d3dfe12c1b77204d673 Mon Sep 17 00:00:00 2001 From: Chuck Lever Date: Sat, 23 Mar 2013 08:13:22 -0400 Subject: [PATCH] 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 --- utils/gssd/krb5_util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; -- 2.39.5