New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[agw][mme] Make ctime call thread safe #4216
Conversation
Signed-off-by: Shruti Sanadhya <ssanadhya@fb.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@@ -563,7 +563,8 @@ static char* log_get_readable_cur_time(time_t* cur_time) { | |||
// get the current local time | |||
*cur_time = time(NULL); | |||
// get the current local time in readable string format | |||
return (strtok(ctime(cur_time), "\n")); | |||
char buf[26]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is exact buf required, I would gone with larger buffer than required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pshelar missed this comment before merging this PR. Could you please suggest an alternative size for the buffer? I can fix it in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
32 bytes.
Signed-off-by: Shruti Sanadhya <ssanadhya@fb.com>
backported |
Signed-off-by: Shruti Sanadhya ssanadhya@fb.com
Summary
MME service encountered seg faults due to memory corruption while calling ctime. This change replaces
ctime
withctime_r
Test Plan
make integ_test