From 0acd1426fd5cb2e03a04a29664beb4a2e0bb9c56 Mon Sep 17 00:00:00 2001 From: Hyunil Date: Thu, 20 Dec 2018 16:50:38 +0900 Subject: [PATCH] Avoid changing errnum of strerror_r by dlog Change-Id: Iec86bc156b2dbb701d4ebcab38dc0e2727f579c7 Signed-off-by: Hyunil --- src/media_streamer_util.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/media_streamer_util.c b/src/media_streamer_util.c index 7b62507..147b160 100644 --- a/src/media_streamer_util.c +++ b/src/media_streamer_util.c @@ -354,6 +354,8 @@ int __ms_util_uri_path_check(const char *file_uri) { struct stat stat_results = {0, }; int file_open = 0; + char mes_error[256]; + int errnum = 0; ms_debug_fenter(); @@ -362,11 +364,11 @@ int __ms_util_uri_path_check(const char *file_uri) file_open = open(file_uri, O_RDONLY); if (file_open < 0) { - char mes_error[256]; - strerror_r(errno, mes_error, sizeof(mes_error)); - ms_error("Couldn`t open file [%s] according to [%s]. Error N [%d]", file_uri, mes_error, errno); + errnum = errno; + strerror_r(errnum, mes_error, sizeof(mes_error)); + ms_error("Couldn`t open file [%s] according to [%s]. Error N [%d]", file_uri, mes_error, errnum); - if (EACCES == errno) + if (EACCES == errnum) return MEDIA_STREAMER_ERROR_PERMISSION_DENIED; return MEDIA_STREAMER_ERROR_INVALID_PARAMETER; -- 2.7.4