Merge pull request #19302 from bluca/uninit

tree-wide: avoid uninitialized warning on _cleanup_ variables
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2021-04-14 16:25:35 +02:00
committed by GitHub
63 changed files with 118 additions and 112 deletions
+1 -1
View File
@@ -350,7 +350,7 @@ int cache_efi_options_variable(void) {
* (NB: For testing purposes, we still check the $SYSTEMD_EFI_OPTIONS env var before accessing this
* cache, even when in SecureBoot mode.) */
if (is_efi_secure_boot()) {
_cleanup_free_ char *k;
_cleanup_free_ char *k = NULL;
k = efi_variable_path(EFI_VENDOR_SYSTEMD, "SystemdOptions");
if (!k)
+1 -1
View File
@@ -772,7 +772,7 @@ void lookup_paths_log(LookupPaths *p) {
log_debug("Ignoring unit files.");
p->search_path = strv_free(p->search_path);
} else {
_cleanup_free_ char *t;
_cleanup_free_ char *t = NULL;
t = strv_join(p->search_path, "\n\t");
log_debug("Looking for unit files in (higher priority first):\n\t%s", strna(t));
+2 -2
View File
@@ -52,7 +52,7 @@ static volatile int cached_color_mode = _COLOR_INVALID;
static volatile int cached_underline_enabled = -1;
int chvt(int vt) {
_cleanup_close_ int fd;
_cleanup_close_ int fd = -1;
/* Switch to the specified vt number. If the VT is specified <= 0 switch to the VT the kernel log messages go,
* if that's configured. */
@@ -514,7 +514,7 @@ int terminal_vhangup_fd(int fd) {
}
int terminal_vhangup(const char *name) {
_cleanup_close_ int fd;
_cleanup_close_ int fd = -1;
fd = open_terminal(name, O_RDWR|O_NOCTTY|O_CLOEXEC|O_NONBLOCK);
if (fd < 0)
+1 -1
View File
@@ -1547,7 +1547,7 @@ int time_change_fd(void) {
.it_value.tv_sec = TIME_T_MAX,
};
_cleanup_close_ int fd;
_cleanup_close_ int fd = -1;
assert_cc(sizeof(time_t) == sizeof(TIME_T_MAX));