writing zero bytes in bash

Miloslav Trmac mitr at volny.cz
Sat Feb 26 10:49:16 UTC 2005


On Sat, Feb 26, 2005 at 09:39:42PM +1100, Russell Coker wrote:
> Actually I am not asking for a feature to be added, but for a feature to be 
> removed.  There is special-case code in bash if(size >0) write() and I am 
> merely suggesting that the if statement be removed.
Really? My guess is actually something like this:
	left = (len of data);
	p = (start of data);
	while (left != 0) {
		r = write (fd, p, left);
		if (r < 0) {
			if (errno != EINTR) error;
			r = 0;
		}
		p += r;
		left -= r;
	}
which "looks" perfectly natural.
	Mirek




More information about the fedora-devel-list mailing list