Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
26e79288
Commit
26e79288
authored
Mar 06, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vlc_rand_bytes: minor thread-safety fix
We need the lock to read okey and ikey
parent
e80d8803
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
src/misc/rand.c
src/misc/rand.c
+6
-4
No files found.
src/misc/rand.c
View file @
26e79288
...
@@ -92,19 +92,21 @@ void vlc_rand_bytes (void *buf, size_t len)
...
@@ -92,19 +92,21 @@ void vlc_rand_bytes (void *buf, size_t len)
uint64_t
val
;
uint64_t
val
;
struct
md5_s
mdi
,
mdo
;
struct
md5_s
mdi
,
mdo
;
InitMD5
(
&
mdi
);
InitMD5
(
&
mdo
);
pthread_mutex_lock
(
&
lock
);
pthread_mutex_lock
(
&
lock
);
if
(
counter
==
0
)
if
(
counter
==
0
)
vlc_rand_init
();
vlc_rand_init
();
val
=
counter
++
;
val
=
counter
++
;
pthread_mutex_unlock
(
&
lock
);
InitMD5
(
&
mdi
);
AddMD5
(
&
mdi
,
ikey
,
sizeof
(
ikey
));
AddMD5
(
&
mdi
,
ikey
,
sizeof
(
ikey
));
AddMD5
(
&
mdo
,
okey
,
sizeof
(
okey
));
pthread_mutex_unlock
(
&
lock
);
AddMD5
(
&
mdi
,
&
stamp
,
sizeof
(
stamp
));
AddMD5
(
&
mdi
,
&
stamp
,
sizeof
(
stamp
));
AddMD5
(
&
mdi
,
&
val
,
sizeof
(
val
));
AddMD5
(
&
mdi
,
&
val
,
sizeof
(
val
));
EndMD5
(
&
mdi
);
EndMD5
(
&
mdi
);
InitMD5
(
&
mdo
);
AddMD5
(
&
mdo
,
okey
,
sizeof
(
okey
));
AddMD5
(
&
mdo
,
mdi
.
p_digest
,
sizeof
(
mdi
.
p_digest
));
AddMD5
(
&
mdo
,
mdi
.
p_digest
,
sizeof
(
mdi
.
p_digest
));
EndMD5
(
&
mdo
);
EndMD5
(
&
mdo
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment