* limitations under the License.
*/
+#include <sys/stat.h>
+#include <sys/types.h>
#include <unistd.h>
#include <string>
return MIME_TYPE_ERROR_IO_ERROR;
}
+ struct stat statbuf;
+ int ret = stat(file_path, &statbuf);
+ if (ret != 0) {
+ _E("stat() is failed. path(%s), errno(%d)", file_path, errno);
+ return MIME_TYPE_ERROR_IO_ERROR;
+ }
+
+ if (!S_ISREG(statbuf.st_mode)) {
+ _E("%s is not regular file", file_path);
+ return MIME_TYPE_ERROR_INVALID_PARAMETER;
+ }
+
auto xdg_mime_type = content::XdgMime::GetMimeTypeForFile(file_path);
if (xdg_mime_type.empty()) {
_E("GetMimeTypeForFile(%s) is failed", file_path);