secmgr: ensure that unknown error exist
[src/app-framework-main.git] / src / secmgr-wrap.c
index 87aa5a5..78680a5 100644 (file)
@@ -1,6 +1,8 @@
 /*
  Copyright 2015 IoT.bzh
 
+ author: José Bollo <jose.bollo@iot.bzh>
+
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
@@ -34,7 +36,7 @@ static int retcode(enum lib_retcode rc)
        case SECURITY_MANAGER_ERROR_REQ_NOT_COMPLETE: errno = EBADMSG; break;
        case SECURITY_MANAGER_ERROR_AUTHENTICATION_FAILED: errno = EPERM; break;
        case SECURITY_MANAGER_ERROR_ACCESS_DENIED: errno = EACCES; break;
-       default: errno = 0; break;
+       default: errno = ECANCELED; break;
        }
        return -1;
 }
@@ -113,3 +115,8 @@ int secmgr_path_read_write(const char *pathname)
        return addpath(pathname, SECURITY_MANAGER_PATH_RW);
 }
 
+int secmgr_prepare_exec(const char *appid)
+{
+       return retcode(security_manager_prepare_app(appid));
+}
+