X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fmime.c;h=24eebb7395af21e6f972535607ca1cba4b2c2341;hb=4b3aeef57b4ddc4e481170a0b700b8a51a3beda4;hp=cd89551236065c2d8afa774f71f3ace6a7e27fa6;hpb=e3d5bb584aa5549e9b245ade34757e3419ae61a7;p=framework%2Fappfw%2Faul-1.git diff --git a/src/mime.c b/src/mime.c index cd89551..24eebb7 100755 --- a/src/mime.c +++ b/src/mime.c @@ -19,6 +19,7 @@ * */ +#define _GNU_SOURCE #include "aul.h" #include "aul_api.h" #include "miregex.h" @@ -172,17 +173,25 @@ SLPAPI int aul_get_mime_icon(const char *mimetype, char *iconname, int len) SLPAPI int aul_get_mime_from_file(const char *filename, char *mimetype, int len) { const char *mime; - struct stat statbuf; + struct stat statbuf; + char err_buf[128] = {0,}; + if (filename == NULL) return AUL_R_EINVAL; if (access(filename, F_OK) != 0) { - _E("access fail(%s)", strerror(errno)); + if (!strerror_r(errno, err_buf, sizeof(err_buf))) + _E("access fail(%s)", err_buf); + else + _E("access fail(%d)", errno); return AUL_R_EINVAL; } - if (stat(filename, &statbuf) != 0){ - _E("Unable to get stat, error is %s", strerror(errno)); + if (stat(filename, &statbuf) != 0) { + if (!strerror_r(errno, err_buf, sizeof(err_buf))) + _E("Unable to get stat, error is %s", err_buf); + else + _E("Unable to get stat, error is %d", errno); return AUL_R_ERROR; } if(S_ISDIR(statbuf.st_mode))