Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
relibc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
redox-os
relibc
Commits
7e4a60f7
Commit
7e4a60f7
authored
6 years ago
by
Jeremy Soller
Browse files
Options
Downloads
Patches
Plain Diff
Fix possible deadlocks
parent
658dc34d
No related branches found
No related tags found
No related merge requests found
Pipeline
#1363
failed
6 years ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/header/stdio/mod.rs
+5
-3
5 additions, 3 deletions
src/header/stdio/mod.rs
with
5 additions
and
3 deletions
src/header/stdio/mod.rs
+
5
−
3
View file @
7e4a60f7
...
@@ -307,9 +307,7 @@ pub extern "C" fn ferror(stream: &mut FILE) -> c_int {
...
@@ -307,9 +307,7 @@ pub extern "C" fn ferror(stream: &mut FILE) -> c_int {
#[no_mangle]
#[no_mangle]
pub
unsafe
extern
"C"
fn
fflush
(
stream
:
&
mut
FILE
)
->
c_int
{
pub
unsafe
extern
"C"
fn
fflush
(
stream
:
&
mut
FILE
)
->
c_int
{
flockfile
(
stream
);
flockfile
(
stream
);
let
ret
=
helpers
::
fflush_unlocked
(
stream
);
let
ret
=
helpers
::
fflush_unlocked
(
stream
);
funlockfile
(
stream
);
funlockfile
(
stream
);
ret
ret
}
}
...
@@ -362,6 +360,7 @@ pub extern "C" fn fgets(s: *mut c_char, n: c_int, stream: &mut FILE) -> *mut c_c
...
@@ -362,6 +360,7 @@ pub extern "C" fn fgets(s: *mut c_char, n: c_int, stream: &mut FILE) -> *mut c_c
{
{
// We can't read from this stream
// We can't read from this stream
if
!
stream
.can_read
()
{
if
!
stream
.can_read
()
{
funlockfile
(
stream
);
return
ptr
::
null_mut
();
return
ptr
::
null_mut
();
}
}
}
}
...
@@ -408,8 +407,9 @@ pub extern "C" fn fgets(s: *mut c_char, n: c_int, stream: &mut FILE) -> *mut c_c
...
@@ -408,8 +407,9 @@ pub extern "C" fn fgets(s: *mut c_char, n: c_int, stream: &mut FILE) -> *mut c_c
#[no_mangle]
#[no_mangle]
pub
extern
"C"
fn
fileno
(
stream
:
&
mut
FILE
)
->
c_int
{
pub
extern
"C"
fn
fileno
(
stream
:
&
mut
FILE
)
->
c_int
{
flockfile
(
stream
);
flockfile
(
stream
);
let
fd
=
stream
.fd
;
funlockfile
(
stream
);
funlockfile
(
stream
);
stream
.
fd
fd
}
}
/// Lock the file
/// Lock the file
...
@@ -483,6 +483,7 @@ pub extern "C" fn fread(ptr: *mut c_void, size: usize, nitems: usize, stream: &m
...
@@ -483,6 +483,7 @@ pub extern "C" fn fread(ptr: *mut c_void, size: usize, nitems: usize, stream: &m
flockfile
(
stream
);
flockfile
(
stream
);
if
!
stream
.can_read
()
{
if
!
stream
.can_read
()
{
funlockfile
(
stream
);
return
0
;
return
0
;
}
}
...
@@ -601,6 +602,7 @@ pub extern "C" fn fseeko(stream: &mut FILE, offset: off_t, whence: c_int) -> c_i
...
@@ -601,6 +602,7 @@ pub extern "C" fn fseeko(stream: &mut FILE, offset: off_t, whence: c_int) -> c_i
}
}
stream
.write
=
None
;
stream
.write
=
None
;
if
stream
.seek
(
off
,
whence
)
<
0
{
if
stream
.seek
(
off
,
whence
)
<
0
{
funlockfile
(
stream
);
return
-
1
;
return
-
1
;
}
}
stream
.read
=
None
;
stream
.read
=
None
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment