From 67d5db8908afbd40bf290ad9e771453cc099abc5 Mon Sep 17 00:00:00 2001 From: Jan Synacek Date: Wed, 8 Jan 2014 15:01:37 +0100 Subject: logicalfile: replace thread-unsafe functions Some functions, such as readdir() and dirname(), are not thread-safe. Use equivalent glib functions. trac: #173 --- src/logicalfile/LMI_UnixDirectoryProvider.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/logicalfile/LMI_UnixDirectoryProvider.c') diff --git a/src/logicalfile/LMI_UnixDirectoryProvider.c b/src/logicalfile/LMI_UnixDirectoryProvider.c index 0f5c69b..f6b0e24 100644 --- a/src/logicalfile/LMI_UnixDirectoryProvider.c +++ b/src/logicalfile/LMI_UnixDirectoryProvider.c @@ -93,8 +93,10 @@ static CMPIStatus LMI_UnixDirectoryCreateInstance( if (mkdir(path, 0777) < 0) { char errmsg[BUFLEN]; - char strerrmsg[STRERROR_BUF_LEN]; - snprintf(errmsg, BUFLEN, "Can't mkdir: %s (%s)", path, strerror_r(errno, strerrmsg, sizeof(strerrmsg))); + char strerr[BUFLEN]; + snprintf(errmsg, BUFLEN, "Can't mkdir: %s (%s)", + path, + strerror_r(errno, strerr, BUFLEN)); CMReturnWithChars(_cb, CMPI_RC_ERR_FAILED, errmsg); } @@ -122,8 +124,10 @@ static CMPIStatus LMI_UnixDirectoryDeleteInstance( if (rmdir(path) < 0) { char errmsg[BUFLEN]; - char strerrmsg[STRERROR_BUF_LEN]; - snprintf(errmsg, BUFLEN, "Can't rmdir: %s (%s)", path, strerror_r(errno, strerrmsg, sizeof(strerrmsg))); + char strerr[BUFLEN]; + snprintf(errmsg, BUFLEN, "Can't rmdir: %s (%s)", + path, + strerror_r(errno, strerr, BUFLEN)); CMReturnWithChars(_cb, CMPI_RC_ERR_FAILED, errmsg); } -- cgit