mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-01 11:32:25 +00:00
Bug 6873 - Finish moving from the non-threadsafe (and poor randomness) rand() to threadsafe ast_random()
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@17627 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
2
app.c
2
app.c
@@ -1157,7 +1157,7 @@ enum AST_LOCK_RESULT ast_lock_path(const char *path)
|
||||
return AST_LOCK_FAILURE;
|
||||
}
|
||||
|
||||
snprintf(fs, strlen(path) + 19, "%s/.lock-%08x", path, rand());
|
||||
snprintf(fs, strlen(path) + 19, "%s/.lock-%08lx", path, ast_random());
|
||||
fd = open(fs, O_WRONLY | O_CREAT | O_EXCL, 0600);
|
||||
if (fd < 0) {
|
||||
fprintf(stderr, "Unable to create lock file '%s': %s\n", path, strerror(errno));
|
||||
|
||||
Reference in New Issue
Block a user