diff options
author | Kyeonghun Lee <kh9090.lee@samsung.com> | 2016-12-22 16:12:34 +0900 |
---|---|---|
committer | Kyeonghun Lee <kh9090.lee@samsung.com> | 2016-12-22 16:14:55 +0900 |
commit | 2ec1f5cdcaceceb5f3bd153743a54f536e5f4ee9 (patch) | |
tree | e254ca896c6a1d442787774b8f0af4c80d9ec892 | |
parent | ffc15c26da88e1ec509f81273ef5eef2c2b6ff70 (diff) | |
download | msg-service-2ec1f5cdcaceceb5f3bd153743a54f536e5f4ee9.tar.gz msg-service-2ec1f5cdcaceceb5f3bd153743a54f536e5f4ee9.tar.bz2 msg-service-2ec1f5cdcaceceb5f3bd153743a54f536e5f4ee9.zip |
use sd_get_active_uids() instead of sd_get_uids() for getting active user id
Change-Id: I91f1790686d5a13398e0b942956b90ae346497f6
Signed-off-by: Kyeonghun Lee <kh9090.lee@samsung.com>
-rwxr-xr-x | utils/MsgUtilFunction.cpp | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/utils/MsgUtilFunction.cpp b/utils/MsgUtilFunction.cpp index 61851c6..554dbf6 100755 --- a/utils/MsgUtilFunction.cpp +++ b/utils/MsgUtilFunction.cpp @@ -1226,30 +1226,20 @@ gchar * msg_replace_non_ascii_char(const gchar *pszText, gunichar replacementCha static int __find_login_user(uid_t *uid) { uid_t *uids = NULL; - char *state = NULL; - int uids_len = sd_get_uids(&uids); - if (uids_len <= 0) + int uids_len = sd_get_active_uids(&uids); + if (uids == NULL) return -1; - for (int i = 0; i < uids_len; i++) { - if (sd_uid_get_state(uids[i], &state) < 0) { - free(uids); - return -1; - } else { - if (g_strcmp0(state, "online") == 0) { - *uid = uids[i]; - free(uids); - free(state); - return 0; - } - } - - free(state); + if (uids_len != 1) { + free(uids); + return -1; } + *uid = uids[0]; + free(uids); - return -1; + return 0; } |