diff options
Diffstat (limited to 'src/bm_util.c')
-rw-r--r-- | src/bm_util.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/bm_util.c b/src/bm_util.c index 5665a51..49f397a 100644 --- a/src/bm_util.c +++ b/src/bm_util.c @@ -369,7 +369,7 @@ void bd_get_focussed_app_id(char **app_name) return; } -void bm_get_name_from_pid(pid_t pid, char **pname) +void bm_get_name_for_pid(pid_t pid, char **pname) { _INFO("pid = [%d]", pid); @@ -383,6 +383,11 @@ void bm_get_name_from_pid(pid_t pid, char **pname) snprintf(buf, PATH_MAX, "/proc/%d/cmdline", pid); + if (access(buf, F_OK) != 0) { + _ERR("maybe pid no more exists"); + return; + } + fd = open(buf, O_RDONLY); if (fd < 0) { _ERR("process(%d) does not exist now.", pid); |