[Accel-config] [PATCH v1 4/5] accel-config: Print error message associated with error at exit
ramesh.thomas at intel.com
| Newsgroups | dev.linux.lists.accel-config |
|---|---|
| Message-ID | <[email protected]> |
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
Assign error code returned by commands to errno and use perror to print
a short description of the error at app exit.
Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
---
accfg/accel-config.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/accfg/accel-config.c b/accfg/accel-config.c
index f12e449..de6fdb9 100644
--- a/accfg/accel-config.c
+++ b/accfg/accel-config.c
@@ -143,5 +143,8 @@ int main(int argc, const char **argv)
if (!rc)
return EXIT_SUCCESS;
error_exit:
+ errno = abs(rc);
+ perror("Error");
+
return EXIT_FAILURE;
}
--
2.26.2