From owner-cvs-src-old@FreeBSD.ORG Wed Nov 5 12:13:15 2008 Return-Path: Delivered-To: cvs-src-old@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB683106567A for ; Wed, 5 Nov 2008 12:13:15 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id A95238FC1F for ; Wed, 5 Nov 2008 12:13:15 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id mA5CDF0g084245 for ; Wed, 5 Nov 2008 12:13:15 GMT (envelope-from des@repoman.freebsd.org) Received: (from svn2cvs@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id mA5CDF4s084244 for cvs-src-old@freebsd.org; Wed, 5 Nov 2008 12:13:15 GMT (envelope-from des@repoman.freebsd.org) Message-Id: <200811051213.mA5CDF4s084244@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: svn2cvs set sender to des@repoman.freebsd.org using -f From: Dag-Erling Smorgrav Date: Wed, 5 Nov 2008 12:13:10 +0000 (UTC) To: cvs-src-old@freebsd.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/lib/libutil realhostname.c X-BeenThere: cvs-src-old@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: **OBSOLETE** CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Nov 2008 12:13:15 -0000 des 2008-11-05 12:13:10 UTC FreeBSD src repository Modified files: lib/libutil realhostname.c Log: SVN rev 184683 on 2008-11-05 12:13:10Z by des Like many other functions that handle sockaddrs, realhostname_sa() takes a struct sockaddr * that it casts internally to the appropriate type based on sa_family. However, struct sockaddr has very lax alignment requirements, which causes the compiler to complain when you cast a struct sockaddr * to, say, a struct sockaddr_in6 *. I find it reasonable to assume that the pointer we received is in fact correctly aligned. Therefore, we can work around the compiler warnings by casting to void * before casting to the desired type. For readability's sake, this is done with macros. The same technique should prove useful in other parts of the tree that deal with socket addresses. MFC after: 3 weeks Revision Changes Path 1.20 +18 -5 src/lib/libutil/realhostname.c