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
This commit is contained in:
Maxim Konovalov 2016-08-12 08:16:35 +00:00
parent d293af4049
commit 30bebccae0

View File

@ -1494,8 +1494,8 @@ aml_disassemble(ACPI_TABLE_HEADER *rsdt, ACPI_TABLE_HEADER *dsdp)
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, ACPI_TABLE_HEADER *dsdp)
}
/* 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");