Strange pipe behaviour in the latest svn version
Bernhard Fischer
rep.nop at aon.at
Fri Oct 20 01:13:31 PDT 2006
On Thu, Oct 19, 2006 at 07:30:56PM +0200, Denis Vlasenko wrote:
>On Wednesday 18 October 2006 07:41, Alexander Griesser wrote:
>Bingo! static busybox doesn't fflush stdout!
>This workaround made readlink work:
No! :)
>int readlink_main(int argc, char **argv)
>{
> char *buf;
> unsigned opt = ENABLE_FEATURE_READLINK_FOLLOW ?
> getopt32(argc, argv, "f") : 0;
>
> if (argc != (ENABLE_FEATURE_READLINK_FOLLOW ? optind + 1 : 2))
> bb_show_usage();
>
> if (opt & READLINK_FLAG_f)
> buf = realpath(argv[optind], bb_common_bufsiz1);
> else
> buf = xreadlink(argv[ENABLE_FEATURE_READLINK_FOLLOW ? optind : 1]);
>
> if (!buf)
> return EXIT_FAILURE;
> puts(buf);
->+ fflush(stdout);
>
> if (ENABLE_FEATURE_CLEAN_UP && buf != bb_common_bufsiz1)
> free(buf);
>
-> return EXIT_SUCCESS;
+ bb_fflush_stdout_and_exit(EXIT_SUCCESS);
>}
>
>Need to take a look how glibc managed to botch it...
Please don't botch busybox but reuse the stuff that is already there ;)
text data bss dec hex filename
98 0 0 98 62 debianutils/readlink.o.orig
110 0 0 110 6e debianutils/readlink.o.vda
103 0 0 103 67 debianutils/readlink.o.bb_fflush
cheers,
More information about the busybox
mailing list