shithub: npe

ref: ba4b0723d9e6d6ec72ca54016a932e72fbae46f7
dir: /libnpe/mkdir.c/

View raw version
#include <unistd.h>

int
mkdir(char *path, int perm)
{
	int f;

	if(access(path, AEXIST) == 0){
		werrstr("%s: already exists", path);
		return -1;
	}
	if((f = create(path, OREAD, DMDIR|perm)) < 0){
		werrstr("%s: can't create: %r", path);
		return -1;
	}
	close(f);

	return 0;
}