From 14f9584e135ca51a29020ba5c7f0b363467436fe Mon Sep 17 00:00:00 2001 From: "jiyong.min" Date: Thu, 10 Jan 2019 13:24:30 +0900 Subject: [PATCH] Fix the log position to avoid errno change. Change-Id: Ia7d81de1f5fa4aa766e3d700497d2cadc314456e --- src/metadata_editor.cpp | 3 ++- test/metadata_editor_test.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/metadata_editor.cpp b/src/metadata_editor.cpp index 7d4004e..7d8379a 100755 --- a/src/metadata_editor.cpp +++ b/src/metadata_editor.cpp @@ -826,10 +826,11 @@ extern "C" int metadata_editor_set_path(metadata_editor_h metadata, const char * /* check the file exits actually */ exist = open(path, O_RDONLY); if(exist < 0) { - metadata_editor_error("Not exist file"); if (errno == EACCES || errno == EPERM) { + metadata_editor_error("Permission denied"); return METADATA_EDITOR_ERROR_PERMISSION_DENIED; } else { + metadata_editor_error("Not exist file"); return METADATA_EDITOR_ERROR_FILE_EXISTS; } } diff --git a/test/metadata_editor_test.c b/test/metadata_editor_test.c index 1f84eb3..9e08768 100755 --- a/test/metadata_editor_test.c +++ b/test/metadata_editor_test.c @@ -413,7 +413,7 @@ int main(int argc, char *argv[]) /*__printRetValue("metadata_editor_create(...)",ret); */ if (ret != METADATA_EDITOR_ERROR_NONE) { - printf("Fail metadata_editor_create() at line [%d]\n", __LINE__); + printf("Fail metadata_editor_create() [%d]\n", ret); return 0; } @@ -421,7 +421,7 @@ int main(int argc, char *argv[]) /*__printRetValue("metadata_editor_set_path(...)",ret); */ if (ret != METADATA_EDITOR_ERROR_NONE) { - printf("Fail metadata_editor_set_path() at line [%d]\n", __LINE__); + printf("Fail metadata_editor_set_path() [%d]\n", ret); goto exception; } -- 2.34.1