Skip to content

Commit

Permalink
Applications: Fix a potential issue that help messages may be dumped …
Browse files Browse the repository at this point in the history
…to AcpiGbl_DebugFile

This is a regression fix, restoring usage macro to its original
implementation.

There is an issue for usage macros, if an command line option changed
AcpiGbl_DebugFile, then the follow up usage message may be errornously
dumped to the debug file.
This is just a bug in theory, because currently AcpiGbl_DebugFile can only
be modified by acpibin and acpiexec. And this will not trigger such issue
because:
1. For acpibin, AcpiGbl_DebugFile will be modified by "-t" option and the
   program exits after processing this option without dumping help message
   or other error options.
2. For acpiexec, AcpiGbl_DebugFile will only be modified by the open
   command, which happens after parsing the command line options, so no
   help message will be dumped into the debug file.
But maintaining this logic is difficult, so this patch modifies
AcpiOsPrintf() into printf() for usage macros so that the help messages are
ensured to be dumped to the stdout. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
  • Loading branch information
Lv Zheng committed Jul 22, 2016
1 parent 189429f commit d1b7372
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions source/include/acapps.h
Expand Up @@ -155,13 +155,13 @@
/* Macros for usage messages */

#define ACPI_USAGE_HEADER(Usage) \
AcpiOsPrintf ("Usage: %s\nOptions:\n", Usage);
printf ("Usage: %s\nOptions:\n", Usage);

#define ACPI_USAGE_TEXT(Description) \
AcpiOsPrintf (Description);
printf (Description);

#define ACPI_OPTION(Name, Description) \
AcpiOsPrintf (" %-20s%s\n", Name, Description);
printf (" %-20s%s\n", Name, Description);


/* Check for unexpected exceptions */
Expand Down

0 comments on commit d1b7372

Please sign in to comment.