From: Jim Meyering Date: Thu, 16 Sep 2021 20:23:46 +0000 (-0700) Subject: build: avoid new chmod.c warnings from upcoming GCC12 X-Git-Tag: v9.0~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3283cc7725bd7d070b772225b263e7f7718c8195;p=thirdparty%2Fcoreutils.git 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. --- 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)