diff options
Diffstat (limited to 'tools/power')
-rw-r--r-- | tools/power/acpi/tools/acpidump/apfiles.c | 30 | ||||
-rw-r--r-- | tools/power/acpi/tools/acpidump/apmain.c | 4 |
2 files changed, 27 insertions, 7 deletions
diff --git a/tools/power/acpi/tools/acpidump/apfiles.c b/tools/power/acpi/tools/acpidump/apfiles.c index 5781c13ae333..d470046a6d81 100644 --- a/tools/power/acpi/tools/acpidump/apfiles.c +++ b/tools/power/acpi/tools/acpidump/apfiles.c @@ -44,6 +44,27 @@ #include "acpidump.h" #include "acapps.h" +/* Local prototypes */ + +static int ap_is_existing_file(char *pathname); + +static int ap_is_existing_file(char *pathname) +{ +#ifndef _GNU_EFI + struct stat stat_info; + + if (!stat(pathname, &stat_info)) { + acpi_log_error("Target path already exists, overwrite? [y|n] "); + + if (getchar() != 'y') { + return (-1); + } + } +#endif + + return 0; +} + /****************************************************************************** * * FUNCTION: ap_open_output_file @@ -59,17 +80,12 @@ int ap_open_output_file(char *pathname) { - struct stat stat_info; ACPI_FILE file; /* If file exists, prompt for overwrite */ - if (!stat(pathname, &stat_info)) { - acpi_log_error("Target path already exists, overwrite? [y|n] "); - - if (getchar() != 'y') { - return (-1); - } + if (ap_is_existing_file(pathname) != 0) { + return (-1); } /* Point stdout to the file */ diff --git a/tools/power/acpi/tools/acpidump/apmain.c b/tools/power/acpi/tools/acpidump/apmain.c index 35bd6740306e..853b4da22c3e 100644 --- a/tools/power/acpi/tools/acpidump/apmain.c +++ b/tools/power/acpi/tools/acpidump/apmain.c @@ -291,7 +291,11 @@ static int ap_do_options(int argc, char **argv) * ******************************************************************************/ +#ifndef _GNU_EFI int ACPI_SYSTEM_XFACE main(int argc, char *argv[]) +#else +int ACPI_SYSTEM_XFACE acpi_main(int argc, char *argv[]) +#endif { int status = 0; struct ap_dump_action *action; |