diff options
Diffstat (limited to 'src')
27 files changed, 37 insertions, 37 deletions
diff --git a/src/import/pull-job.c b/src/import/pull-job.c index ed9af2351f..42939f2104 100644 --- a/src/import/pull-job.c +++ b/src/import/pull-job.c @@ -76,7 +76,7 @@ void pull_job_curl_on_finished(CurlGlue *g, CURL *curl, CURLcode result) { long status; int r; - if (curl_easy_getinfo(curl, CURLINFO_PRIVATE, &j) != CURLE_OK) + if (curl_easy_getinfo(curl, CURLINFO_PRIVATE, (char **)&j) != CURLE_OK) return; if (!j || j->state == PULL_JOB_DONE || j->state == PULL_JOB_FAILED) diff --git a/src/journal-remote/journal-gatewayd.c b/src/journal-remote/journal-gatewayd.c index 6efc9b385f..bba0d12ee7 100644 --- a/src/journal-remote/journal-gatewayd.c +++ b/src/journal-remote/journal-gatewayd.c @@ -748,7 +748,7 @@ static int request_handler_machine( RequestMeta *m = connection_cls; int r; _cleanup_free_ char* hostname = NULL, *os_name = NULL; - uint64_t cutoff_from = 0, cutoff_to = 0, usage; + uint64_t cutoff_from = 0, cutoff_to = 0, usage = 0; char *json; sd_id128_t mid, bid; _cleanup_free_ char *v = NULL; diff --git a/src/journal-remote/journal-remote-parse.c b/src/journal-remote/journal-remote-parse.c index e8442d319e..5ff05d3ad6 100644 --- a/src/journal-remote/journal-remote-parse.c +++ b/src/journal-remote/journal-remote-parse.c @@ -321,7 +321,7 @@ static int process_data(RemoteSource *source) { switch(source->state) { case STATE_LINE: { char *line, *sep; - size_t n; + size_t n = 0; assert(source->data_size == 0); diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c index 6198a99b75..f87a939168 100644 --- a/src/journal-remote/journal-remote.c +++ b/src/journal-remote/journal-remote.c @@ -349,7 +349,7 @@ static int remove_source(RemoteServer *s, int fd) { static int add_source(RemoteServer *s, int fd, char* name, bool own_name) { - RemoteSource *source; + RemoteSource *source = NULL; int r; /* This takes ownership of name, even on failure, if own_name is true. */ @@ -1144,7 +1144,7 @@ static int dispatch_raw_connection_event(sd_event_source *event, .size = sizeof(union sockaddr_union), .type = SOCK_STREAM, }; - char *hostname; + char *hostname = NULL; fd2 = accept_connection("raw", fd, &addr, &hostname); if (fd2 < 0) 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); diff --git a/src/libsystemd-network/lldp-tlv.c b/src/libsystemd-network/lldp-tlv.c index e43d70d3cf..e32783f3eb 100644 --- a/src/libsystemd-network/lldp-tlv.c +++ b/src/libsystemd-network/lldp-tlv.c @@ -156,7 +156,7 @@ static inline int tlv_packet_read_internal(tlv_section *m, void **data) { } int tlv_packet_read_u8(tlv_packet *m, uint8_t *data) { - void *val; + void *val = NULL; int r; assert_return(m, -EINVAL); @@ -174,7 +174,7 @@ int tlv_packet_read_u8(tlv_packet *m, uint8_t *data) { int tlv_packet_read_u16(tlv_packet *m, uint16_t *data) { uint16_t t; - void *val; + void *val = NULL; int r; assert_return(m, -EINVAL); @@ -211,7 +211,7 @@ int tlv_packet_read_u32(tlv_packet *m, uint32_t *data) { } int tlv_packet_read_string(tlv_packet *m, char **data, uint16_t *data_length) { - void *val; + void *val = NULL; int r; assert_return(m, -EINVAL); @@ -229,7 +229,7 @@ int tlv_packet_read_string(tlv_packet *m, char **data, uint16_t *data_length) { } int tlv_packet_read_bytes(tlv_packet *m, uint8_t **data, uint16_t *data_length) { - void *val; + void *val = NULL; int r; assert_return(m, -EINVAL); diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c index 2634a730d6..a0a2320efa 100644 --- a/src/libsystemd-network/sd-dhcp-server.c +++ b/src/libsystemd-network/sd-dhcp-server.c @@ -775,7 +775,7 @@ int dhcp_server_handle_message(sd_dhcp_server *server, DHCPMessage *message, if (pool_offset >= 0 && server->bound_leases[pool_offset] == existing_lease) { DHCPLease *lease; - usec_t time_now; + usec_t time_now = 0; if (!existing_lease) { lease = new0(DHCPLease, 1); diff --git a/src/libsystemd-network/sd-pppoe.c b/src/libsystemd-network/sd-pppoe.c index e8e7d994df..601f3bd400 100644 --- a/src/libsystemd-network/sd-pppoe.c +++ b/src/libsystemd-network/sd-pppoe.c @@ -339,7 +339,7 @@ static int pppoe_timeout(sd_event_source *s, uint64_t usec, void *userdata); static int pppoe_arm_timeout(sd_pppoe *ppp) { _cleanup_event_source_unref_ sd_event_source *timeout = NULL; - usec_t next_timeout; + usec_t next_timeout = 0; int r; assert(ppp); diff --git a/src/libsystemd/sd-login/sd-login.c b/src/libsystemd/sd-login/sd-login.c index f71749f72d..cc0677bdf2 100644 --- a/src/libsystemd/sd-login/sd-login.c +++ b/src/libsystemd/sd-login/sd-login.c @@ -82,7 +82,7 @@ _public_ int sd_pid_get_owner_uid(pid_t pid, uid_t *uid) { } _public_ int sd_peer_get_session(int fd, char **session) { - struct ucred ucred; + struct ucred ucred = {}; int r; assert_return(fd >= 0, -EINVAL); diff --git a/src/network/networkctl.c b/src/network/networkctl.c index 3a6faa273d..46653189fb 100644 --- a/src/network/networkctl.c +++ b/src/network/networkctl.c @@ -975,7 +975,7 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) { return r; } else if (streq(a, "_TTL")) { - long long unsigned x; + long long unsigned x = 0; usec_t time; r = safe_atollu(b, &x); diff --git a/src/resolve/resolved-dns-transaction.c b/src/resolve/resolved-dns-transaction.c index 74b0634142..bc1a90db1b 100644 --- a/src/resolve/resolved-dns-transaction.c +++ b/src/resolve/resolved-dns-transaction.c @@ -252,7 +252,7 @@ static int dns_transaction_open_tcp(DnsTransaction *t) { fd = dns_scope_tcp_socket(t->scope, t->received->family, &t->received->sender, t->received->sender_port); else { union in_addr_union address; - int family; + int family = AF_UNSPEC; /* Otherwise, try to talk to the owner of a * the IP address, in case this is a reverse diff --git a/src/resolve/test-dns-domain.c b/src/resolve/test-dns-domain.c index 2f3edaf783..c3208abc78 100644 --- a/src/resolve/test-dns-domain.c +++ b/src/resolve/test-dns-domain.c @@ -161,7 +161,7 @@ static void test_dns_name_single_label(void) { static void test_dns_name_reverse_one(const char *address, const char *name) { _cleanup_free_ char *p = NULL; - union in_addr_union a, b; + union in_addr_union a, b = {}; int familya, familyb; assert_se(in_addr_from_string_auto(address, &familya, &a) >= 0); diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c index 6bd317f354..11e0947407 100644 --- a/src/shared/base-filesystem.c +++ b/src/shared/base-filesystem.c @@ -50,7 +50,7 @@ static const BaseFilesystem table[] = { int base_filesystem_create(const char *root) { _cleanup_close_ int fd = -1; unsigned i; - int r; + int r = 0; fd = open(root, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW); if (fd < 0) diff --git a/src/shared/btrfs-util.c b/src/shared/btrfs-util.c index 62b1eff6ae..a95cb8394f 100644 --- a/src/shared/btrfs-util.c +++ b/src/shared/btrfs-util.c @@ -717,7 +717,7 @@ int btrfs_resize_loopback_fd(int fd, uint64_t new_size, bool grow_only) { _cleanup_free_ char *p = NULL, *loop = NULL, *backing = NULL; _cleanup_close_ int loop_fd = -1, backing_fd = -1; struct stat st; - dev_t dev; + dev_t dev = 0; int r; /* btrfs cannot handle file systems < 16M, hence use this as minimum */ diff --git a/src/shared/capability.c b/src/shared/capability.c index 4840c3ebf4..58f00e6dae 100644 --- a/src/shared/capability.c +++ b/src/shared/capability.c @@ -50,7 +50,7 @@ unsigned long cap_last_cap(void) { static thread_local unsigned long saved; static thread_local bool valid = false; _cleanup_free_ char *content = NULL; - unsigned long p; + unsigned long p = 0; int r; if (valid) diff --git a/src/shared/copy.c b/src/shared/copy.c index 9e4c3b0f72..775a339856 100644 --- a/src/shared/copy.c +++ b/src/shared/copy.c @@ -360,7 +360,7 @@ int copy_file_fd(const char *from, int fdt, bool try_reflink) { } int copy_file(const char *from, const char *to, int flags, mode_t mode, unsigned chattr_flags) { - int fdt, r; + int fdt = -1, r; assert(from); assert(to); @@ -390,7 +390,7 @@ int copy_file(const char *from, const char *to, int flags, mode_t mode, unsigned } int copy_file_atomic(const char *from, const char *to, mode_t mode, bool replace, unsigned chattr_flags) { - _cleanup_free_ char *t; + _cleanup_free_ char *t = NULL; int r; assert(from); @@ -421,7 +421,7 @@ int copy_file_atomic(const char *from, const char *to, mode_t mode, bool replace int copy_times(int fdf, int fdt) { struct timespec ut[2]; struct stat st; - usec_t crtime; + usec_t crtime = 0; assert(fdf >= 0); assert(fdt >= 0); diff --git a/src/shared/install.c b/src/shared/install.c index 9c680a761b..1cc999b4d3 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -1793,7 +1793,7 @@ UnitFileState unit_file_lookup_state( UnitFileState state = _UNIT_FILE_STATE_INVALID; char **i; _cleanup_free_ char *path = NULL; - int r; + int r = 0; assert(paths); diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c index 5a3ab3da3e..4e1b87814b 100644 --- a/src/shared/logs-show.c +++ b/src/shared/logs-show.c @@ -990,7 +990,7 @@ static int show_journal(FILE *f, if (warn_cutoff && line < how_many && not_before > 0) { sd_id128_t boot_id; - usec_t cutoff; + usec_t cutoff = 0; /* Check whether the cutoff line is too early */ diff --git a/src/shared/util.c b/src/shared/util.c index 8b76531d4f..605fffcb7a 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -2882,7 +2882,7 @@ int getttyname_malloc(int fd, char **ret) { int getttyname_harder(int fd, char **r) { int k; - char *s; + char *s = NULL; k = getttyname_malloc(fd, &s); if (k < 0) @@ -3435,7 +3435,7 @@ char **replace_env_argv(char **argv, char **env) { /* If $FOO appears as single word, replace it by the split up variable */ if ((*i)[0] == '$' && (*i)[1] != '{') { char *e; - char **w, **m; + char **w, **m = NULL; unsigned q; e = strv_env_get(env, *i+1); diff --git a/src/test/test-path.c b/src/test/test-path.c index 4f9f5c1344..a3295aa997 100644 --- a/src/test/test-path.c +++ b/src/test/test-path.c @@ -33,7 +33,7 @@ static int setup_test(Manager **m) { char **tests_path = STRV_MAKE("exists", "existsglobFOOBAR", "changed", "modified", "unit", "directorynotempty", "makedirectory"); char **test_path; - Manager *tmp; + Manager *tmp = NULL; int r; assert_se(m); diff --git a/src/test/test-pty.c b/src/test/test-pty.c index eadecb99a0..b5f4d4f094 100644 --- a/src/test/test-pty.c +++ b/src/test/test-pty.c @@ -95,7 +95,7 @@ static void run_parent(Pty *pty) { static void test_pty(void) { pid_t pid; - Pty *pty; + Pty *pty = NULL; rcvsiz = 0; zero(rcvbuf); diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c index 361de0d18e..86d09bbff2 100644 --- a/src/udev/net/link-config.c +++ b/src/udev/net/link-config.c @@ -469,7 +469,7 @@ int link_config_apply(link_config_ctx *ctx, link_config *config, int link_get_driver(link_config_ctx *ctx, struct udev_device *device, char **ret) { const char *name; - char *driver; + char *driver = NULL; int r; name = udev_device_get_sysname(device); |