diff options
author | Tomas Bzatek <tbzatek@redhat.com> | 2014-01-09 15:15:53 +0100 |
---|---|---|
committer | Tomas Bzatek <tbzatek@redhat.com> | 2014-01-09 15:15:53 +0100 |
commit | d1660672c0ba88e75b27af85449a0d39abed8408 (patch) | |
tree | b17318153a396f0af5108bdc2343c9cbc5af46ed /src/hardware/utils.c | |
parent | bc16e11fb41146aee30f851bd41de9d645ad68bb (diff) | |
download | openlmi-providers-d1660672c0ba88e75b27af85449a0d39abed8408.tar.gz openlmi-providers-d1660672c0ba88e75b27af85449a0d39abed8408.tar.xz openlmi-providers-d1660672c0ba88e75b27af85449a0d39abed8408.zip |
Use re-entrant version of strerror() for thread safety
Diffstat (limited to 'src/hardware/utils.c')
-rw-r--r-- | src/hardware/utils.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/hardware/utils.c b/src/hardware/utils.c index 305cc1e..fdce75d 100644 --- a/src/hardware/utils.c +++ b/src/hardware/utils.c @@ -132,6 +132,7 @@ short run_command(const char *command, char ***buffer, unsigned *buffer_size) { FILE *fp = NULL; short ret = -1; + char errbuf[STRERROR_BUF_LEN]; /* if command is empty */ if (!command || strlen(command) < 1) { @@ -144,7 +145,7 @@ short run_command(const char *command, char ***buffer, unsigned *buffer_size) fp = popen(command, "r"); if (!fp) { warn("Failed to run command: \"%s\"; Error: %s", - command, strerror(errno)); + command, strerror_r(errno, errbuf, sizeof(errbuf))); goto done; } @@ -159,7 +160,7 @@ done: int ret_code = pclose(fp); if (ret_code == -1) { warn("Failed to run command: \"%s\"; Error: %s", - command, strerror(errno)); + command, strerror_r(errno, errbuf, sizeof(errbuf))); if (ret == 0) { ret = -1; } |