[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: warning in lchown.c

From: Bruno Haible
Subject: Re: warning in lchown.c
Date: Sat, 20 Mar 2010 16:54:37 +0100
User-agent: KMail/1.9.9

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

2010-03-20  Bruno Haible  <address@hidden>
            Jim Meyering  <address@hidden>

        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 @@
 rpl_lchown (const char *file, uid_t uid, gid_t gid)
-  struct stat st;
   bool stat_valid = false;
   int result;
+  struct stat st;
   if (gid != (gid_t) -1 || uid != (uid_t) -1)
       if (lstat (file, &st))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]