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-vt/sys/src/libc/9sys/putenv.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 <u.h>
2
#include <libc.h>
3
 
4
int
5
putenv(char *name, char *val)
6
{
7
	int f;
8
	char ename[100];
9
	long s;
10
 
11
	if(strchr(name, '/') != nil)
12
		return -1;
13
	snprint(ename, sizeof ename, "/env/%s", name);
14
	if(strcmp(ename+5, name) != 0)
15
		return -1;
16
	f = create(ename, OWRITE, 0664);
17
	if(f < 0)
18
		return -1;
19
	s = strlen(val);
20
	if(write(f, val, s) != s){
21
		close(f);
22
		return -1;
23
	}
24
	close(f);
25
	return 0;
26
}