canonicalize: fix references to stat() and lstat()
authorPádraig Brady <P@draigBrady.com>
Fri, 30 Dec 2011 15:36:50 +0000 (15:36 +0000)
committerPádraig Brady <P@draigBrady.com>
Fri, 30 Dec 2011 15:38:50 +0000 (15:38 +0000)
* lib/canonicalize.c (canonicalize_filename_mode):
Ensure references always resolve to a replacement
function if required (even via a macro).

The issue was spotted by Eric Blake and is
adequately documented in the docs for stat and lstat.

ChangeLog
lib/canonicalize.c

index e61be47..ff9c84a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-12-30  Pádraig Brady  <P@draigBrady.com>
+
+       canonicalize: fix references to stat() and lstat()
+       * lib/canonicalize.c (canonicalize_filename_mode):
+       Ensure references always resolve to a replacement
+       function if required (even via a macro).
+
 2011-12-30  Jim Meyering  <meyering@redhat.com>
 
        gitlog-to-changelog: remove a little duplication
index a5c9cb4..e84c339 100644 (file)
@@ -198,7 +198,7 @@ canonicalize_filename_mode (const char *name, canonicalize_mode_t can_mode)
           dest += end - start;
           *dest = '\0';
 
-          if ((logical ? stat : lstat) (rname, &st) != 0)
+          if ((logical ? stat (rname, &st) : lstat (rname, &st)) != 0)
             {
               saved_errno = errno;
               if (can_mode == CAN_EXISTING)