summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorDenis Vlasenko2009-03-04 01:30:32 +0000
committerDenis Vlasenko2009-03-04 01:30:32 +0000
commitdadf7907b20a305127c5e7f3adb0ba3f69a0b0b0 (patch)
tree7f18d658127ea00162efc17a4a40e85cab8a1de3 /coreutils
parent22f180fd6c1f8186dea0ba4ee1451b5241051b5e (diff)
downloadbusybox-dadf7907b20a305127c5e7f3adb0ba3f69a0b0b0.zip
busybox-dadf7907b20a305127c5e7f3adb0ba3f69a0b0b0.tar.gz
printf: fix breakage in handling '*'
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/printf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/coreutils/printf.c b/coreutils/printf.c
index b0a48cd..ca8e51c 100644
--- a/coreutils/printf.c
+++ b/coreutils/printf.c
@@ -139,14 +139,14 @@ static void print_direc(char *format, unsigned fmt_length,
char saved;
char *have_prec, *have_width;
+ saved = format[fmt_length];
+ format[fmt_length] = '\0';
+
have_prec = strstr(format, ".*");
have_width = strchr(format, '*');
if (have_width - 1 == have_prec)
have_width = NULL;
- saved = format[fmt_length];
- format[fmt_length] = '\0';
-
switch (format[fmt_length - 1]) {
case 'c':
printf(format, *argument);