diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2012-11-20 21:01:59 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2012-11-20 21:01:59 +0000 |
commit | ed17e06e2cdf97a1c05c04d88ef6c54cbdb34871 (patch) | |
tree | fa7a75101aa590769412545429cb755ccbff57f4 /sys/contrib/dev/acpica/compiler/dttemplate.c | |
parent | c153604de3156f9aabcebface2b84b3e1696ce79 (diff) | |
parent | c2463a8709e5b3a5ce54c09d35b4820a756b0fc5 (diff) |
Merge ACPICA 20121114.
Notes
Notes:
svn path=/head/; revision=243347
Diffstat (limited to 'sys/contrib/dev/acpica/compiler/dttemplate.c')
-rw-r--r-- | sys/contrib/dev/acpica/compiler/dttemplate.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/sys/contrib/dev/acpica/compiler/dttemplate.c b/sys/contrib/dev/acpica/compiler/dttemplate.c index 9e02a876a910..fda712bb4218 100644 --- a/sys/contrib/dev/acpica/compiler/dttemplate.c +++ b/sys/contrib/dev/acpica/compiler/dttemplate.c @@ -280,6 +280,7 @@ DtCreateOneTemplate ( char *DisasmFilename; FILE *File; ACPI_STATUS Status = AE_OK; + ACPI_SIZE Actual; /* New file will have a .asl suffix */ @@ -334,18 +335,32 @@ DtCreateOneTemplate ( } else { - /* Special ACPI tables - DSDT, SSDT, FACS, RSDP */ + /* Special ACPI tables - DSDT, SSDT, FADT, RSDP */ AcpiOsPrintf (" */\n\n"); if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_DSDT)) { - fwrite (TemplateDsdt, sizeof (TemplateDsdt) -1, 1, File); + Actual = fwrite (TemplateDsdt, 1, sizeof (TemplateDsdt) -1, File); + if (Actual != sizeof (TemplateDsdt) -1) + { + fprintf (stderr, + "Could not write to output file %s\n", DisasmFilename); + Status = AE_ERROR; + goto Cleanup; + } } else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_SSDT)) { - fwrite (TemplateSsdt, sizeof (TemplateSsdt) -1, 1, File); + Actual = fwrite (TemplateSsdt, 1, sizeof (TemplateSsdt) -1, File); + if (Actual != sizeof (TemplateSsdt) -1) + { + fprintf (stderr, + "Could not write to output file %s\n", DisasmFilename); + Status = AE_ERROR; + goto Cleanup; + } } - else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS)) + else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS)) /* FADT */ { AcpiDmDumpDataTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER, TemplateFacs)); @@ -359,7 +374,8 @@ DtCreateOneTemplate ( { fprintf (stderr, "%4.4s, Unrecognized ACPI table signature\n", Signature); - return (AE_ERROR); + Status = AE_ERROR; + goto Cleanup; } } @@ -367,6 +383,7 @@ DtCreateOneTemplate ( "Created ACPI table template for [%4.4s], written to \"%s\"\n", Signature, DisasmFilename); +Cleanup: fclose (File); AcpiOsRedirectOutput (stdout); ACPI_FREE (DisasmFilename); |