Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include "lib.h"
2
#include <sys/stat.h>
3
#include <errno.h>
4
#include "sys9.h"
5
 
6
/*
7
 * BUG: errno mapping
8
 */
9
int
10
mkdir(const char *name, mode_t mode)
11
{
12
	int n;
13
	struct stat st;
14
 
15
	if(stat(name, &st)==0) {
16
		errno = EEXIST;
17
		return -1;
18
	}
19
	n = _CREATE(name, 0, 0x80000000|(mode&0777));
20
	if(n < 0)
21
		_syserrno();
22
	else{
23
		_CLOSE(n);
24
		n = 0;
25
	}
26
	return n;
27
}