Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #1359 from pavelpatrin/spooler-fix-inconsistent-read
Fix reading inconsisntent data from spooler
  • Loading branch information
unbit committed Sep 6, 2016
2 parents 1ed9bd2 + 32bf46e commit dab97d5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/spooler.c
Expand Up @@ -650,6 +650,12 @@ void spooler_manage_task(struct uwsgi_spooler *uspool, char *dir, char *task) {
if (uwsgi_spooler_read_header(task, spool_fd, &uh))
return;

// access lstat second time after getting a lock
// first-time lstat could be dirty (for example between writes in master)
if (lstat(task, &sf_lstat)) {
return;
}

if (uwsgi_spooler_read_content(spool_fd, spool_buf, &body, &body_len, &uh, &sf_lstat)) {
destroy_spool(dir, task);
return;
Expand Down

0 comments on commit dab97d5

Please sign in to comment.