pi->pkgmgr_info = strndup(optarg, MAX_STRLEN);
break;
+ case 'u': /* uid */
+ pi->target_uid = (uid_t)atoi(optarg);
+ break;
+
/* Otherwise */
case '?': /* Not an option */
break;
return pi->request_type;
}
+API uid_t pkgmgr_installer_get_uid(pkgmgr_installer *pi)
+{
+ CHK_PI_RET(PKGMGR_REQ_INVALID);
+ return pi->target_uid;
+}
+
API const char *pkgmgr_installer_get_request_info(pkgmgr_installer *pi)
{
CHK_PI_RET(PKGMGR_REQ_INVALID);
int pkgmgr_installer_get_request_type(pkgmgr_installer *pi);
/**
+ @brief Get uid
+ @pre pkgmgr_installer_receive_request() must be called.
+ @post None
+ @see pkgmgr_installer_receive_request
+ @param[in] pi pkgmgr_installer object
+ @return Uid info.
+ @retval NULL on function failure
+ @remark Returned uid must not be modified.
+ @code
+#include <pkgmgr_installer.h>
+int main(int argc, char **argv)
+{
+ pkgmgr_installer *pi;
+ int r = 0;
+ uid_t uid;
+
+ pi = pkgmgr_installer_new();
+ if(!pi) return -1;
+ if(pkgmgr_installer_receive_request(pi, argc, argv)) {
+ r = -1;
+ goto CLEANUP_RET;
+ }
+ uid = pkgmgr_installer_get_uid(pi);
+
+ // Do something...
+
+ pkgmgr_installer_free(pi);
+ return r;
+}
+ @endcode
+ */
+uid_t pkgmgr_installer_get_uid(pkgmgr_installer *pi);
+
+/**
@brief Get request info
@pre pkgmgr_installer_receive_request() must be called.
@post None
#define OPTVAL_FORCE_REMOVAL 1001
/* Supported options */
-const char *short_opts = "k:l:i:d:c:m:t:o:r:p:s:b:e:M:y:w:D:A:q";
+const char *short_opts = "k:l:i:d:c:m:t:o:r:p:s:b:e:M:y:u:w:D:A:q";
const struct option long_opts[] = {
{ "session-id", 1, NULL, 'k' },
{ "license-path", 1, NULL, 'l' },