plan 9 kernel history: overview | file list | diff list

2001/0405/port/parse.c (diff list | history)

2001/0331/sys/src/9/port/parse.c:13,292001/0405/sys/src/9/port/parse.c:13,36 (short | long | prev | next)
Bug fix: only call smalloc, waserror, poperror when running a user process.
rsc Fri Mar 4 12:44:25 2005
1999/0316    
{ 
2001/0331    
	Cmdbuf *volatile cb; 
1999/0316    
 
	cb = smalloc(sizeof(*cb)); 
2001/0405    
	if(up != nil) 
		cb = smalloc(sizeof(*cb)); 
	else{ 
		cb = malloc(sizeof(*cb)); 
		if(cb == nil) 
			return nil; 
	} 
1999/0316    
	 
	if(n > sizeof(cb->buf)-1) 
		n = sizeof(cb->buf)-1; 
2001/0331    
 
	if(waserror()){ 
2001/0405    
	if(up != nil && waserror()){ 
2001/0331    
		free(cb); 
		nexterror(); 
	} 
1999/0316    
	memmove(cb->buf, p, n); 
2001/0331    
	poperror(); 
2001/0405    
	if(up != nil) 
		poperror(); 
2001/0331    
 
1999/0316    
	if(n > 0 && cb->buf[n-1] == '\n') 
		n--; 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)