1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-08 11:27:32 +03:00

coredump: make sure variable is set if uncompressed

reorder the code so the fstat is done before we can jump to
uncompressed
This commit is contained in:
Thomas Hindoe Paaboel Andersen 2014-06-27 00:07:39 +02:00
parent de8f6e5463
commit 7849c2acd4

View File

@ -345,16 +345,16 @@ static int save_external_coredump(const char *info[_INFO_LEN],
goto fail; goto fail;
} }
if (lseek(fd, 0, SEEK_SET) == (off_t) -1) {
log_error("Failed to seek on %s: %m", tmp);
goto uncompressed;
}
if (fstat(fd, &st) < 0) { if (fstat(fd, &st) < 0) {
log_error("Failed to fstat coredump %s: %m", tmp); log_error("Failed to fstat coredump %s: %m", tmp);
goto fail; goto fail;
} }
if (lseek(fd, 0, SEEK_SET) == (off_t) -1) {
log_error("Failed to seek on %s: %m", tmp);
goto uncompressed;
}
#ifdef HAVE_XZ #ifdef HAVE_XZ
/* If we will remove the coredump anyway, do not compress. */ /* If we will remove the coredump anyway, do not compress. */
if (maybe_remove_external_coredump(NULL, st.st_size) == 0 if (maybe_remove_external_coredump(NULL, st.st_size) == 0