]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(print_it): Properly handle a backslash at the
authorJim Meyering <jim@meyering.net>
Thu, 15 Dec 2005 20:15:20 +0000 (20:15 +0000)
committerJim Meyering <jim@meyering.net>
Thu, 15 Dec 2005 20:15:20 +0000 (20:15 +0000)
end of a --printf format string.  Reported by Paul Eggert.

src/stat.c

index 0773860ad5651912542586110934d832c4f21224..0ce83d173fb193a4af2378b2862b99b310ca5eeb 100644 (file)
@@ -665,6 +665,13 @@ print_it (char const *format, char const *filename,
                }
              putchar (esc_value);
            }
+         else if (*b == '\0')
+           {
+             error (0, 0, _("warning: backslash at end of format"));
+             putchar ('\\');
+             /* Arrange to exit the loop.  */
+             --b;
+           }
          else
            {
              print_esc_char (*b);