Race condition call lazy_create () before file_stream_create()
since now stream_open() does not do anything.
Showing
2 changed files
with
9 additions
and
3 deletions
... | @@ -150,12 +150,13 @@ body_get_stream (body_t body, stream_t *pstream) | ... | @@ -150,12 +150,13 @@ body_get_stream (body_t body, stream_t *pstream) |
150 | int status = stream_create (&body->stream, MU_STREAM_RDWR, body); | 150 | int status = stream_create (&body->stream, MU_STREAM_RDWR, body); |
151 | if (status != 0) | 151 | if (status != 0) |
152 | return status; | 152 | return status; |
153 | status = file_stream_create (&body->fstream, body->filename, MU_STREAM_RDWR); | 153 | /* Create the temporary file. */ |
154 | if (status != 0) | ||
155 | return status; | ||
156 | fd = lazy_create (body); | 154 | fd = lazy_create (body); |
157 | if (fd == -1) | 155 | if (fd == -1) |
158 | return errno; | 156 | return errno; |
157 | status = file_stream_create (&body->fstream, body->filename, MU_STREAM_RDWR); | ||
158 | if (status != 0) | ||
159 | return status; | ||
159 | status = stream_open (body->fstream); | 160 | status = stream_open (body->fstream); |
160 | close (fd); | 161 | close (fd); |
161 | if (status != 0) | 162 | if (status != 0) | ... | ... |
-
Please register or sign in to post a comment