diff options
author | Harald Hoyer <harald@redhat.com> | 2015-03-27 12:02:49 +0100 |
---|---|---|
committer | Harald Hoyer <harald@redhat.com> | 2015-03-27 14:57:38 +0100 |
commit | a7f7d1bde43fc825c49afea3f946f5b4b3d563e0 (patch) | |
tree | e6202adf568f95dbf22d7fb0c51f8c9220a56964 /src/journal | |
parent | 47d45d3cde45d6545367570264e4e3636bc9e345 (diff) |
fix gcc warnings about uninitialized variables
like:
src/shared/install.c: In function ‘unit_file_lookup_state’:
src/shared/install.c:1861:16: warning: ‘r’ may be used uninitialized in
this function [-Wmaybe-uninitialized]
return r < 0 ? r : state;
^
src/shared/install.c:1796:13: note: ‘r’ was declared here
int r;
^
Diffstat (limited to 'src/journal')
-rw-r--r-- | src/journal/catalog.c | 2 | ||||
-rw-r--r-- | src/journal/coredump.c | 4 | ||||
-rw-r--r-- | src/journal/journal-file.c | 6 | ||||
-rw-r--r-- | src/journal/journal-vacuum.c | 2 | ||||
-rw-r--r-- | src/journal/journalctl.c | 2 | ||||
-rw-r--r-- | src/journal/test-journal-stream.c | 2 |
6 files changed, 9 insertions, 9 deletions
diff --git a/src/journal/catalog.c b/src/journal/catalog.c index e505a05305..0801e13599 100644 --- a/src/journal/catalog.c +++ b/src/journal/catalog.c @@ -558,7 +558,7 @@ static const char *find_id(void *p, sd_id128_t id) { int catalog_get(const char* database, sd_id128_t id, char **_text) { _cleanup_close_ int fd = -1; void *p = NULL; - struct stat st; + struct stat st = {}; char *text = NULL; int r; const char *s; diff --git a/src/journal/coredump.c b/src/journal/coredump.c index 6357d3e277..4e23e487fb 100644 --- a/src/journal/coredump.c +++ b/src/journal/coredump.c @@ -242,7 +242,7 @@ static int maybe_remove_external_coredump(const char *filename, off_t size) { static int make_filename(const char *info[_INFO_LEN], char **ret) { _cleanup_free_ char *c = NULL, *u = NULL, *p = NULL, *t = NULL; - sd_id128_t boot; + sd_id128_t boot = {}; int r; assert(info); @@ -841,7 +841,7 @@ log: /* Optionally store the entire coredump in the journal */ if (IN_SET(arg_storage, COREDUMP_STORAGE_JOURNAL, COREDUMP_STORAGE_BOTH) && coredump_size <= (off_t) arg_journal_size_max) { - size_t sz; + size_t sz = 0; /* Store the coredump itself in the journal */ diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c index 8e7642710e..5a4e7cbd7d 100644 --- a/src/journal/journal-file.c +++ b/src/journal/journal-file.c @@ -887,7 +887,7 @@ int journal_file_find_data_object_with_hash( if (o->object.flags & OBJECT_COMPRESSION_MASK) { #if defined(HAVE_XZ) || defined(HAVE_LZ4) uint64_t l; - size_t rsize; + size_t rsize = 0; l = le64toh(o->object.size); if (l <= offsetof(Object, data.payload)) @@ -1052,7 +1052,7 @@ static int journal_file_append_data( #if defined(HAVE_XZ) || defined(HAVE_LZ4) if (f->compress_xz && size >= COMPRESSION_SIZE_THRESHOLD) { - size_t rsize; + size_t rsize = 0; compression = compress_blob(data, size, o->data.payload, &rsize); @@ -2886,7 +2886,7 @@ int journal_file_copy_entry(JournalFile *from, JournalFile *to, Object *o, uint6 if (o->object.flags & OBJECT_COMPRESSION_MASK) { #if defined(HAVE_XZ) || defined(HAVE_LZ4) - size_t rsize; + size_t rsize = 0; r = decompress_blob(o->object.flags & OBJECT_COMPRESSION_MASK, o->data.payload, l, &from->compress_buffer, &from->compress_buffer_size, &rsize, 0); diff --git a/src/journal/journal-vacuum.c b/src/journal/journal-vacuum.c index a367dc1bb9..81a577ea27 100644 --- a/src/journal/journal-vacuum.c +++ b/src/journal/journal-vacuum.c @@ -73,7 +73,7 @@ static void patch_realtime( unsigned long long *realtime) { _cleanup_free_ const char *path = NULL; - usec_t x, crtime; + usec_t x, crtime = 0; /* The timestamp was determined by the file name, but let's * see if the file might actually be older than the file name diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index 7fbd518d3f..b4f88bcd0a 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -1487,7 +1487,7 @@ static int verify(sd_journal *j) { ORDERED_HASHMAP_FOREACH(f, j->files, i) { int k; - usec_t first, validated, last; + usec_t first = 0, validated = 0, last = 0; #ifdef HAVE_GCRYPT if (!arg_verify_key && JOURNAL_HEADER_SEALED(f->header)) diff --git a/src/journal/test-journal-stream.c b/src/journal/test-journal-stream.c index 3996e778e6..b8caeb3d41 100644 --- a/src/journal/test-journal-stream.c +++ b/src/journal/test-journal-stream.c @@ -42,7 +42,7 @@ static void verify_contents(sd_journal *j, unsigned skip) { const void *d; char *k, *c; size_t l; - unsigned u; + unsigned u = 0; assert_se(sd_journal_get_cursor(j, &k) >= 0); printf("cursor: %s\n", k); |