Date: Fri, 12 Aug 2016 08:16:35 +0000 (UTC) From: Maxim Konovalov <maxim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r304000 - head/usr.sbin/acpi/acpidump Message-ID: <201608120816.u7C8GZFL033562@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: maxim Date: Fri Aug 12 08:16:35 2016 New Revision: 304000 URL: https://svnweb.freebsd.org/changeset/base/304000 Log: o Move tmpstr varibale initialization out of assert(3) call. This fixes acpidump(8) compiled with "WITHOUT_ASSERT_DEBUG=yes" that removes assert(3)'s from the code. Submitted by: Alexander Nedotsukov Modified: head/usr.sbin/acpi/acpidump/acpi.c Modified: head/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- head/usr.sbin/acpi/acpidump/acpi.c Fri Aug 12 08:08:29 2016 (r303999) +++ head/usr.sbin/acpi/acpidump/acpi.c Fri Aug 12 08:16:35 2016 (r304000) @@ -1494,8 +1494,8 @@ aml_disassemble(ACPI_TABLE_HEADER *rsdt, perror("mkdtemp tmp working dir"); return; } - assert((size_t)snprintf(tmpstr, sizeof(tmpstr), "%s%s", wrkdir, iname) - <= sizeof(tmpstr) - 1); + len = (size_t)snprintf(tmpstr, sizeof(tmpstr), "%s%s", wrkdir, iname); + assert(len <= sizeof(tmpstr) - 1); fd = open(tmpstr, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR); if (fd < 0) { perror("iasl tmp file"); @@ -1527,8 +1527,8 @@ aml_disassemble(ACPI_TABLE_HEADER *rsdt, } /* Dump iasl's output to stdout */ - assert((size_t)snprintf(tmpstr, sizeof(tmpstr), "%s%s", wrkdir, oname) - <= sizeof(tmpstr) -1); + len = (size_t)snprintf(tmpstr, sizeof(tmpstr), "%s%s", wrkdir, oname); + assert(len <= sizeof(tmpstr) - 1); fp = fopen(tmpstr, "r"); if (unlink(tmpstr) < 0) { perror("unlink");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201608120816.u7C8GZFL033562>