On Wednesday 26 January 2011 13:21, Baruch Siach wrote: > Hi busybox list, > > I'm running the following command under strace (thanks Rob): > > echo 56 > /sys/class/gpio/export > > and I see the following output: > > write(1, "56\n", 3) = -1 EBUSY (Device or resource busy) > write(1, "5", 1) = 1 > > The first EBUSY is OK, since GPIO 56 is already requested. But the second > write() attempt seems strange, and leads to an unwanted outcome. GPIO 5 gets > exported. > > Looking into the code it seems like the fflush() call at the end for > echo_main() is somehow responsible for this, but this is only a guess.
I would like to make it so that echo doesn't retry failed writes (except on EINTR). I wonder how to fix this, though. I can easily detect write error, but how to discard buffered data in a FILE object? Even without fflush(), libc will try to write it out at fclose()! -- vda _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
