diff options
Diffstat (limited to 'src/status.c')
-rw-r--r-- | src/status.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/status.c b/src/status.c index 003a6d2c..ab1f0ddc 100644 --- a/src/status.c +++ b/src/status.c @@ -77,12 +77,26 @@ API int aul_app_get_status_bypid(int pid) API int aul_app_get_status_bypid_for_uid(int pid, uid_t uid) { int ret; + char buf[MAX_PID_STR_BUFSZ]; + bundle *b; if (pid == getpid()) return app_status; - ret = aul_sock_send_raw(AUL_UTIL_PID, uid, APP_GET_STATUS, - (unsigned char *)&pid, sizeof(pid), AUL_SOCK_NONE); + b = bundle_create(); + if (b == NULL) { + _E("out of memory"); + return AUL_R_ERROR; + } + + snprintf(buf, sizeof(buf), "%d", pid); + bundle_add(b, AUL_K_PID, buf); + snprintf(buf, sizeof(buf), "%d", uid); + bundle_add(b, AUL_K_TARGET_UID, buf); + + ret = aul_sock_send_bundle(AUL_UTIL_PID, uid, APP_GET_STATUS, + b, AUL_SOCK_NONE); + bundle_free(b); return ret; } @@ -96,6 +110,7 @@ API int aul_app_get_status_for_uid(const char *appid, uid_t uid) { int ret; bundle *kb; + char buf[MAX_PID_STR_BUFSZ]; if (appid == NULL) return AUL_R_EINVAL; @@ -106,7 +121,9 @@ API int aul_app_get_status_for_uid(const char *appid, uid_t uid) return AUL_R_ERROR; } + snprintf(buf, sizeof(buf), "%d", uid); bundle_add(kb, AUL_K_APPID, appid); + bundle_add(kb, AUL_K_TARGET_UID, buf); ret = app_send_cmd_for_uid(AUL_UTIL_PID, uid, APP_GET_STATUS_BY_APPID, kb); bundle_free(kb); |