`du -D symlink-to-dir' would mistakenly omit the slash in
authorJim Meyering <jim@meyering.net>
Fri, 19 Sep 2003 07:39:04 +0000 (07:39 +0000)
committerJim Meyering <jim@meyering.net>
Fri, 19 Sep 2003 07:39:04 +0000 (07:39 +0000)
lines like this:  24 symlink-to-dir/subdir

(process_file): Fix offset calculation.
Reported by Jeff Sheinberg as Debian bug #211591;
http://bugs.debian.org/205251

src/du.c

index 15b4461..c82fa1a 100644 (file)
--- a/src/du.c
+++ b/src/du.c
@@ -474,7 +474,8 @@ process_file (const char *file, const struct stat *sb, int file_type,
          fwrite (file, arg_length, 1, stdout);
          /* Print everything after what we appended.  */
          fputs (file + arg_length + suffix_length
-                + (file[arg_length + suffix_length] == '/'), stdout);
+                + (file[arg_length - 1] == '/'
+                   && file[arg_length + suffix_length] == '/'), stdout);
        }
       else
        {