Commit 019805048372adb5b43c1f8b90482d35f639502f
Use strlen instead of sizeof
Author: Ryan Baumann
Author date (UTC): 2015-02-23 17:51
Committer name: Ryan Baumann
Committer date (UTC): 2015-02-23 17:51
Parent(s): d0d346a0945f8b95876bc00b69f488ae025a2168
Signing key:
Tree: 9ec64cab35a0b9141b95c6ab9dc7fb02caf5823d
File src/hstr_utils.c changed (mode: 100644) (index 9a2104e..554c548) |
... |
... |
char *get_process_name_by_pid(const int pid) |
149 |
149 |
char* shell = strrchr(getenv("SHELL"),'/'); |
char* shell = strrchr(getenv("SHELL"),'/'); |
150 |
150 |
if(shell != NULL){ |
if(shell != NULL){ |
151 |
151 |
shell++; |
shell++; |
152 |
|
strncpy(name,shell,sizeof(char)*sizeof(name)); |
|
|
152 |
|
strncpy(name,shell,sizeof(char)*strlen(shell)); |
153 |
153 |
} |
} |
154 |
154 |
} |
} |
155 |
155 |
return name; |
return name; |