Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
qga: unlink just created guest-file if fchmod() or fdopen() fails on it
We shouldn't allow guest filesystem pollution on error paths.

Suggested-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
(cherry picked from commit 2b72001)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
  • Loading branch information
lersek authored and mdroth committed May 14, 2013
1 parent 67b460a commit 1d7723f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions qga/commands-posix.c
Expand Up @@ -277,6 +277,9 @@ safe_open_or_create(const char *path, const char *mode, Error **err)
}

close(fd);
if (oflag & O_CREAT) {
unlink(path);
}
}
}

Expand Down

0 comments on commit 1d7723f

Please sign in to comment.