Bug 32350

Summary: libstand's write always returns 0 unless error.
Product: Base System Reporter: Jonathan Mini <mini>
Component: kernAssignee: msmith
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 5.0-CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Jonathan Mini 2001-11-28 13:50:01 UTC
	Libstand's implementation of write() returns 0 on success, instead of
	the number of bytes written.

Fix: Apply this patch:
How-To-Repeat: 	Well, it's a little hard to reproduce unless you have my changes to
	allow ufs writes in libstand, as none of the filesystems accept
	write requests and no console access is done via the write()
	interface.

	However, if you apply this patch:

		http://www.haikugeek.com/freebsd/5.0-boot-libstand.diff

	.. which adds limited write support to the ufs code, and then
	open a file and write to it, you will see that write will return
	0 instead of the number of bytes written, e.g.:

		int fd,res;

		fd = open("/etc/motd",O_WRONLY);
		res = write(fd,"foo!",4);
		printf("write: %d bytes written.\n",res);

	will print:

		write: 0 bytes written.
Comment 1 Alfred Perlstein freebsd_committer freebsd_triage 2001-11-30 05:23:59 UTC
Responsible Changed
From-To: freebsd-bugs->msmith

Mike wants to handle this.
Comment 2 Alfred Perlstein freebsd_committer freebsd_triage 2001-11-30 05:52:45 UTC
State Changed
From-To: open->closed

I assigned this to Mike Smith because I thought this was the loader 
write support, I committed and closed it because it's actually a subset 
of that patch that just corrects the semantics of the libstand write 
function.