Jim Meyering wrote: > Instead of adding more #ifdefs, how about just moving that > "struct stat st;" line down a few lines so it's within > the existing #if CHOWN_CHANGE_TIME_BUG block:
It looks a little uglier to me, because the variable 'st' is also used in the third #if block at the end, and the variable 'stat_valid' semantically depends on it. But I don't mind, and am therefore committing this: 2010-03-20 Bruno Haible <br...@clisp.org> Jim Meyering <meyer...@redhat.com> lchown: Avoid "unused variable" warning. * lib/lchown.c (rpl_lchown): Move variable 'st' into #if block. --- lib/lchown.c.orig Sat Mar 20 16:54:00 2010 +++ lib/lchown.c Sat Mar 20 16:50:46 2010 @@ -70,11 +70,12 @@ int rpl_lchown (const char *file, uid_t uid, gid_t gid) { - struct stat st; bool stat_valid = false; int result; # if CHOWN_CHANGE_TIME_BUG + struct stat st; + if (gid != (gid_t) -1 || uid != (uid_t) -1) { if (lstat (file, &st))