summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>2014-06-27 00:07:39 +0200
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>2014-06-27 00:17:58 +0200
commit7849c2acd479278d54851694762b967610912d02 (patch)
tree9b8692c7f91d22a5813bd7441ca49d3f8e896204
parentde8f6e546315fd9d016ff51a52100a669261ba43 (diff)
coredump: make sure variable is set if uncompressed
reorder the code so the fstat is done before we can jump to uncompressed
-rw-r--r--src/journal/coredump.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/journal/coredump.c b/src/journal/coredump.c
index 5e93091f8b..ab8fd2cf0e 100644
--- a/src/journal/coredump.c
+++ b/src/journal/coredump.c
@@ -345,16 +345,16 @@ static int save_external_coredump(const char *info[_INFO_LEN],
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) {
log_error("Failed to fstat coredump %s: %m", tmp);
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
/* If we will remove the coredump anyway, do not compress. */
if (maybe_remove_external_coredump(NULL, st.st_size) == 0