]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: avoid static analysis warnings in ln.c
authorPádraig Brady <P@draigBrady.com>
Thu, 10 Apr 2014 16:09:57 +0000 (17:09 +0100)
committerPádraig Brady <P@draigBrady.com>
Thu, 10 Apr 2014 16:11:25 +0000 (17:11 +0100)
* src/ln.c (do_link): It's not obvious that record_file() is a noop
in the symlink case (in that case dest_set is NULL and so ignored).
So to make it obvious, and to avoid false positives seen in coverity,
add the explicit condition here.

src/ln.c

index 67266997e4dc7cd9f52275f8b8b612111a0ad468..42bccfce770e01e594559ac76f8cba0ac2475465 100644 (file)
--- a/src/ln.c
+++ b/src/ln.c
@@ -343,7 +343,8 @@ do_link (const char *source, const char *dest)
     {
       /* Right after creating a hard link, do this: (note dest name and
          source_stats, which are also the just-linked-destinations stats) */
-      record_file (dest_set, dest, &source_stats);
+      if (! symbolic_link)
+        record_file (dest_set, dest, &source_stats);
 
       if (verbose)
         {