Print strerror
authorDuyoung Jang <duyoung.jang@samsung.com>
Tue, 6 Nov 2012 12:04:11 +0000 (21:04 +0900)
committerDuyoung Jang <duyoung.jang@samsung.com>
Tue, 6 Nov 2012 12:04:11 +0000 (21:04 +0900)
Change-Id: Ic19063e2a6609cb7c71bffd4f02c0dadcd4711d7

inc/InstallerDefs.h
packaging/osp-installer.spec
src/Util/InstallerUtil.cpp

index f255654..03acf8a 100755 (executable)
@@ -21,7 +21,7 @@
 #ifndef _INSTALLER_DEFS_H_
 #define _INSTALLER_DEFS_H_
 
-#define OSP_INSTALLER_VERSION "osp-installer version = [2012/11/06]"
+#define OSP_INSTALLER_VERSION "osp-installer version = [2012/11/07]"
 
 #define DIR_BIN                                L"/bin"
 #define DIR_INFO                       L"/info"
index 2514fa4..e9cad9d 100755 (executable)
@@ -12,6 +12,7 @@ BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  pkgconfig(appsvc)
 BuildRequires:  pkgconfig(pkgmgr)
 BuildRequires:  pkgconfig(pkgmgr-parser)
+BuildRequires:  pkgconfig(app2sd)
 BuildRequires:  pkgconfig(libwbxml2)
 BuildRequires:  pkgconfig(osp-foundation)
 BuildRequires:  osp-foundation-internal-devel
index 36fa0cf..b18a01e 100755 (executable)
@@ -21,6 +21,7 @@
 
 #include <sys/stat.h>
 #include <dirent.h>
+#include <errno.h>
 #include <unistd.h>
 #include <unique_ptr.h>
 
@@ -56,13 +57,13 @@ InstallerUtil::Remove(const Osp::Base::String& filePath)
        TryReturn(pFilePath, false, "[osp-installer] pFilePath is null");
 
        err = lstat(pFilePath.get(), &fileinfo);
-       TryReturn(err >= 0, false, "[osp-installer] lstat() failed, filepath = [%s]", pFilePath.get());
+       TryReturn(err >= 0, false, "[osp-installer] lstat() failed(%s), filepath = [%s]", strerror(errno), pFilePath.get());
 
        if (S_ISLNK(fileinfo.st_mode))
        {
                AppLogTag(OSP_INSTALLER, "Remove(): symlink, path = [%s]", pFilePath.get());
                err = unlink(pFilePath.get());
-               TryReturn(err >= 0, false, "[osp-installer] unlink() failed, filepath = [%s]", pFilePath.get());
+               TryReturn(err >= 0, false, "[osp-installer] unlink() failed(%s), filepath = [%s]", strerror(errno), pFilePath.get());
        }
        else if (S_ISDIR(fileinfo.st_mode))
        {
@@ -177,7 +178,7 @@ InstallerUtil::IsSymlink(const Osp::Base::String& filePath)
        TryReturn(pFilePath, false, "[osp-installer] pFilePath is null");
 
        err = lstat(pFilePath.get(), &fileinfo);
-       TryReturn(err >= 0, false, "[osp-installer] lstat() failed, filepath = [%s]", pFilePath.get());
+       TryReturn(err >= 0, false, "[osp-installer] lstat() failed(%s), filepath = [%s]", strerror(errno), pFilePath.get());
 
        if (S_ISLNK(fileinfo.st_mode))
        {
@@ -219,7 +220,9 @@ InstallerUtil::CreateSymlink(const String& oldPath, const String& newPath)
        TryReturn(pNewPath, false, "[osp-installer] pNewPath is null");
 
        err = symlink(pOldPath.get(), pNewPath.get());
-       TryReturn(err == 0, false, "[osp-installer] symlink() is failed, oldpath = [%s], newpath = [%s]", pOldPath.get(), pNewPath.get());
+       TryReturn(err == 0, false, "[osp-installer] symlink() is failed(%s), oldpath = [%s], newpath = [%s]", strerror(errno), pOldPath.get(), pNewPath.get());
+
+       AppLogTag(OSP_INSTALLER, "CreateSymlink() [%ls] -> [%ls]", newPath.GetPointer(), oldPath.GetPointer());
 
        return true;
 }
@@ -233,7 +236,7 @@ InstallerUtil::ChangeMode(const String& filePath, int mode)
        TryReturn(pFilePath, false, "[osp-installer] pFilePath is null");
 
        err = chmod(pFilePath.get(), mode);
-       TryReturn(err == 0, false, "[osp-installer] chmod() is failed, filepath = [%s], mode = [%o]", pFilePath.get(), mode);
+       TryReturn(err == 0, false, "[osp-installer] chmod() is failed(%s), filepath = [%s], mode = [%o]", strerror(errno), pFilePath.get(), mode);
 
        return true;
 }
@@ -247,7 +250,7 @@ InstallerUtil::ChangeOwner(const String& filePath)
        TryReturn(pFilePath, false, "[osp-installer] pFilePath is null");
 
        err = chown(pFilePath.get(), APP_OWNER_ID, APP_GROUP_ID);
-       TryReturn(err == 0, false, "[osp-installer] chown() is failed, filepath = [%s]", pFilePath.get());
+       TryReturn(err == 0, false, "[osp-installer] chown() is failed(%s), filepath = [%s]", strerror(errno), pFilePath.get());
 
        return true;
 }
@@ -367,6 +370,7 @@ InstallerUtil::CreateSymlinkForAppId(const String& inPath, String& outPath)
        if (InstallerUtil::IsSymlink(PATH_OPT_APPS) == true &&
                        inPath.StartsWith(PATH_OPT_USR_APPS, 0) == true)
        {
+               AppLogTag(OSP_INSTALLER, "CreateSymlinkForAppId() return false, path = [%ls]", inPath.GetPointer());
                outPath = inPath;
                return false;
        }