From 3283cc7725bd7d070b772225b263e7f7718c8195 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 16 Sep 2021 13:23:46 -0700 Subject: [PATCH] build: avoid new chmod.c warnings from upcoming GCC12 Here are the warnings: src/chmod.c:175:3: error: 'ch.new_mode' may be used uninitialized in\ this function [-Werror=maybe-uninitialized] 175 | strmode (ch->new_mode, perms); src/chmod.c:178:3: error: 'ch.old_mode' may be used uninitialized in\ this function [-Werror=maybe-uninitialized] 178 | strmode (ch->old_mode, old_perms); * src/chmod.c (process_file): Initialize ch. Its new_mode and old_mode fields could indeed be used uninitialized to form mode strings, but those are used only when built from initialized members. --- src/chmod.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chmod.c b/src/chmod.c index 4447e784e1..37b04f5006 100644 --- a/src/chmod.c +++ b/src/chmod.c @@ -206,7 +206,7 @@ process_file (FTS *fts, FTSENT *ent) char const *file_full_name = ent->fts_path; char const *file = ent->fts_accpath; const struct stat *file_stats = ent->fts_statp; - struct change_status ch; + struct change_status ch = { 0, }; ch.status = CH_NO_STAT; switch (ent->fts_info) -- 2.47.2