Avoid changing errnum of strerror_r by dlog 79/195979/2 accepted/tizen/unified/20190108.062335 submit/tizen/20181224.063554 submit/tizen/20190107.072633 submit/tizen/20190107.230638
authorHyunil <hyunil46.park@samsung.com>
Thu, 20 Dec 2018 07:50:38 +0000 (16:50 +0900)
committerHyunil <hyunil46.park@samsung.com>
Mon, 24 Dec 2018 04:28:25 +0000 (13:28 +0900)
Change-Id: Iec86bc156b2dbb701d4ebcab38dc0e2727f579c7
Signed-off-by: Hyunil <hyunil46.park@samsung.com>
src/media_streamer_util.c

index 7b62507..147b160 100644 (file)
@@ -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;