More secure and compiler warning fix for sprintf into snprintf

To fix GCC WARNINGS while building.
or
To support error free -D_FORTIFY_SOURCE=2 strict mode compilation.

Change-Id: I999bd83785456a77247e5e1d708e2bdde2eb057b
This commit is contained in:
Raja M 2016-04-19 23:55:14 +05:30
parent 603df0e875
commit a2f37e4fd7
1 changed files with 1 additions and 1 deletions

View File

@ -306,7 +306,7 @@ int set_sched_policy(int tid, SchedPolicy policy)
char thread_name[255];
int fd;
sprintf(statfile, "/proc/%d/stat", tid);
snprintf(statfile, sizeof(statfile), "/proc/%d/stat", tid);
memset(thread_name, 0, sizeof(thread_name));
fd = open(statfile, O_RDONLY);