From owner-svn-src-head@FreeBSD.ORG Wed May 1 05:15:00 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 634C0A1D; Wed, 1 May 2013 05:15:00 +0000 (UTC) (envelope-from wkoszek@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 53BA4192C; Wed, 1 May 2013 05:15:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r415F0gp078235; Wed, 1 May 2013 05:15:00 GMT (envelope-from wkoszek@svn.freebsd.org) Received: (from wkoszek@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r415F0iZ078233; Wed, 1 May 2013 05:15:00 GMT (envelope-from wkoszek@svn.freebsd.org) Message-Id: <201305010515.r415F0iZ078233@svn.freebsd.org> From: "Wojciech A. Koszek" Date: Wed, 1 May 2013 05:15:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r250133 - head/usr.sbin/config X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 May 2013 05:15:00 -0000 Author: wkoszek Date: Wed May 1 05:14:59 2013 New Revision: 250133 URL: http://svnweb.freebsd.org/changeset/base/250133 Log: Make the internal assertion correct--only fail when '\0' is found in places other than the end of the test section. Otherwise, with kernel compiled with Clang which happens to be setting ELF section alignment differently config(8) was throwing assert() failure unnecessarily Reported by: Kimmo Paasiala Tested by: Kimmo Paasiala MFC after: 10 days Modified: head/usr.sbin/config/main.c Modified: head/usr.sbin/config/main.c ============================================================================== --- head/usr.sbin/config/main.c Wed May 1 04:37:45 2013 (r250132) +++ head/usr.sbin/config/main.c Wed May 1 05:14:59 2013 (r250133) @@ -706,17 +706,11 @@ kernconfdump(const char *file) r = fgetc(fp); if (r == EOF) break; - /* - * If '\0' is present in the middle of the configuration - * string, this means something very weird is happening. - * Make such case very visible. However, some architectures - * pad the length of the section with NULs to a multiple of - * sh_addralign, allow a NUL in that part of the section. - */ - if (r == '\0' && (size - i) < align) + if (r == '\0') { + assert(i == size - 1 && + ("\\0 found in the middle of a file")); break; - assert(r != '\0' && ("Char present in the configuration " - "string mustn't be equal to 0")); + } fputc(r, stdout); } fclose(fp);