From: Russ Allbery Date: Tue, 21 Jul 2009 18:04:41 +0000 (-0700) Subject: Fix warnings in vlserver/vlprocs.c X-Git-Tag: openafs-devel-1_5_61~58 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=5cce838a2454927c3fea8ad6defadf1f2ce4833f;p=packages%2Fo%2Fopenafs.git Fix warnings in vlserver/vlprocs.c rxinfo's code to print out the principal corresponding to an rx_call uses static arrays for the principal components but was checking that the array pointer was non-NULL when deciding whether to print principal components. Instead check whether each portion of the principal is the empty string. Add explicit initializations of the static buffers to the empty string so that we're not relying on rxkad_GetServerInfo always initializing them for us. Reviewed-on: http://gerrit.openafs.org/http://gerrit.openafs.org/163 Reviewed-by: Simon Wilkinson Tested-by: Derrick Brashear Reviewed-by: Derrick Brashear --- diff --git a/src/vlserver/vlprocs.c b/src/vlserver/vlprocs.c index 5a5dc1b5e..73f565837 100644 --- a/src/vlserver/vlprocs.c +++ b/src/vlserver/vlprocs.c @@ -95,9 +95,9 @@ rxinfo(struct rx_call *rxcall) { int code; register struct rx_connection *tconn; - char tname[64]; - char tinst[64]; - char tcell[64]; + char tname[64] = ""; + char tinst[64] = ""; + char tcell[64] = ""; afs_uint32 exp; struct in_addr hostAddr; @@ -108,7 +108,10 @@ rxinfo(struct rx_call *rxcall) NULL); if (!code) sprintf(rxinfo_str, "%s %s%s%s%s%s", inet_ntoa(hostAddr), tname, - tinst?".":"", tinst?tinst:"", tcell?"@":"", tcell?tcell:""); + (tinst[0] == '\0') ? "" : ".", + (tinst[0] == '\0') ? "" : tinst, + (tcell[0] == '\0') ? "" : "@", + (tcell[0] == '\0') ? "" : tcell); else sprintf(rxinfo_str, "%s noauth", inet_ntoa(hostAddr)); return (rxinfo_str);