#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
-#include <pwd.h>
#include <sys/inotify.h>
#include "contacts.h"
}
}
-static const char* __ctsvc_inotify_get_username(uid_t uid)
-{
- struct passwd pwd;
- struct passwd* pwd_result;
- char tmp[CTSVC_STR_SHORT_LEN];
-
- int ret = getpwuid_r(uid, &pwd, tmp, sizeof(tmp), &pwd_result);
- if (ret != 0 || pwd_result == NULL) {
- ERR("getpwuid_r() fail");
- return "";
- }
-
- return pwd.pw_name;
-}
-
char* ctsvc_inotify_makepath(const char *file)
{
RETV_IF(NULL == file, NULL);
- static int user_name_max = 32;
+ static int user_id_max = 10;
int path_len = 0;
char *path = NULL;
uid_t uid = getuid();
- const char* user_name = NULL;
#ifdef _CONTACTS_IPC_CLIENT
if (ctsvc_client_is_in_system_session()) {
}
#endif
- path_len = strlen(CTSVC_NOTI_PATH) + user_name_max + strlen(file) + 1;
+ path_len = strlen(CTSVC_NOTI_PATH) + user_id_max + strlen(file) + 1;
path = calloc(1, path_len);
if (NULL == path) {
ERR("calloc() fail");
return NULL;
}
- user_name = __ctsvc_inotify_get_username(uid);
- snprintf(path, path_len, CTSVC_NOTI_PATH"/%s", user_name, file);
+ snprintf(path, path_len, CTSVC_NOTI_PATH"/%s", uid, file);
DBG("%s", path);
return path;
}