Content-Type: multipart/mixed; boundary="===============4802593973066048600==" MIME-Version: 1.0 From: ramesh.thomas at intel.com Subject: [Accel-config] [PATCH v1 4/5] accel-config: Print error message associated with error at exit Date: Mon, 22 Feb 2021 15:27:55 -0500 Message-ID: <20210222202756.186121-5-ramesh.thomas@intel.com> In-Reply-To: 20210222202756.186121-1-ramesh.thomas@intel.com To: accel-config@lists.01.org List-ID: --===============4802593973066048600== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Ramesh Thomas 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 --- 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 =3D abs(rc); + perror("Error"); + return EXIT_FAILURE; } -- = 2.26.2 --===============4802593973066048600==--