From 71f65087f9d5f42f8944fa7ce416cb0e2f7f043e Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Fri, 30 Jun 2017 16:12:57 +0200 Subject: [PATCH] email, exec and unixsock plugins: fix error handling Diff from Jeremie Courreges-Anglas, via Daniel Jakots --- src/email.c | 2 +- src/exec.c | 4 ++-- src/unixsock.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/email.c b/src/email.c index 849b7f93..1da2633a 100644 --- a/src/email.c +++ b/src/email.c @@ -411,7 +411,7 @@ static void *open_connection(void __attribute__((unused)) * arg) { if (status != 0) { char errbuf[1024]; log_warn("getgrnam_r (%s) failed: %s", group, - sstrerror(errno, errbuf, sizeof(errbuf))); + sstrerror(status, errbuf, sizeof(errbuf))); } else if (grp == NULL) { log_warn("No such group: `%s'", group); } else { diff --git a/src/exec.c b/src/exec.c index c84c1c7b..b728654c 100644 --- a/src/exec.c +++ b/src/exec.c @@ -382,7 +382,7 @@ static int fork_child(program_list_t *pl, int *fd_in, int *fd_out, status = getpwnam_r(pl->user, &sp, nambuf, sizeof(nambuf), &sp_ptr); if (status != 0) { ERROR("exec plugin: Failed to get user information for user ``%s'': %s", - pl->user, sstrerror(errno, errbuf, sizeof(errbuf))); + pl->user, sstrerror(status, errbuf, sizeof(errbuf))); goto failed; } @@ -410,7 +410,7 @@ static int fork_child(program_list_t *pl, int *fd_in, int *fd_out, if (0 != status) { ERROR("exec plugin: Failed to get group information " "for group ``%s'': %s", - pl->group, sstrerror(errno, errbuf, sizeof(errbuf))); + pl->group, sstrerror(status, errbuf, sizeof(errbuf))); goto failed; } if (NULL == gr_ptr) { diff --git a/src/unixsock.c b/src/unixsock.c index aa3451e9..b3fa6a37 100644 --- a/src/unixsock.c +++ b/src/unixsock.c @@ -143,7 +143,7 @@ static int us_open_socket(void) { if (status != 0) { char errbuf[1024]; WARNING("unixsock plugin: getgrnam_r (%s) failed: %s", grpname, - sstrerror(errno, errbuf, sizeof(errbuf))); + sstrerror(status, errbuf, sizeof(errbuf))); break; } if (g == NULL) { -- 2.30.2