| Summary: | HUSH: redirecting output of the last line of "printf" does not work | ||
|---|---|---|---|
| Product: | Busybox | Reporter: | Mikel Garai <m.garai> |
| Component: | Other | Assignee: | unassigned |
| Status: | RESOLVED WORKSFORME | ||
| Severity: | minor | CC: | busybox-cvs |
| Priority: | P5 | ||
| Version: | 1.15.x | ||
| Target Milestone: | --- | ||
| Hardware: | Other | ||
| OS: | Linux | ||
| Host: | Target: | ||
| Build: | |||
|
Description
Mikel Garai
2010-01-27 15:10:00 UTC
I forgot to say that the command: printf line | cat > file.txt does the right thing writting "line" to file.txt Does it help if you add a fflush(NULL) in hush.c like this:
static int run_applet_main(char **argv, int (*applet_main_func)(int argc, char **argv))
{
int argc = 0;
while (*argv) {
argc++;
argv++;
}
- return applet_main_func(argc, argv - argc);
+ argc = applet_main_func(argc, argv - argc);
+ fflush(NULL);
+ return argc;
}
Any news? I did not have any time to test it jet, because the patch is not applicable to the version of busybox that I am using (1.15.3, that has no function called run_applet_main in hush.c), and it takes some time to set up everything to test other version. Anyway I will try it ASAP, that could be more time than I would like to be. Thanks, Mikel Any news? I just tested the unstable busybox's hush (1.16.0) and worked well without the patch, so I did not even try to apply it. Thank you very much and sorry for taking so much time to test it, Mikel Garai |