Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/feature_posix/sys/src/ape/lib/ap/plan9/write.c – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include <errno.h>
2
#include <unistd.h>
3
#include "lib.h"
4
#include "sys9.h"
5
 
6
ssize_t
7
write(int d, const void *buf, size_t nbytes)
8
{
9
	int n;
10
 
11
	if(d<0 || d>=OPEN_MAX || !(_fdinfo[d].flags&FD_ISOPEN)){
12
		errno = EBADF;
13
		return -1;
14
	}
15
	if(_fdinfo[d].oflags&O_APPEND)
16
		_SEEK(d, 0, 2);
17
	n = _WRITE(d, buf, nbytes);
18
	if(n < 0)
19
		_syserrno();
20
	return n;
21
}