ref: bef3c5a3c54408a506e5099d62079c7e9e4c2cb0
parent: 1238374df998b7f4a3efcf0532076ee1d18bc575
author: cinap_lenrek <cinap_lenrek@centraldogma>
date: Tue Dec 13 11:12:40 EST 2011
devfs: dont raise "no more trees" if malloc fails
--- a/sys/src/9/port/devfs.c
+++ b/sys/src/9/port/devfs.c
@@ -250,7 +250,7 @@
return nil;
t = trees[i] = mallocz(sizeof(Tree), 1);
if(t == nil)
- return nil;
+ error(Enomem);
if(i == ntrees)
ntrees++;
kstrdup(&t->name, name);
@@ -675,10 +675,11 @@
t = lookuptree(tname);
if(t != nil)
validdevname(t, dname);
- else
+ else{
t = treealloc(tname);
- if(t == nil)
- error("no more trees");
+ if(t == nil)
+ error("no more trees");
+ }
mp = devalloc(t, dname);
if(mp == nil){
if(t->ndevs == 0) /* it was created for us */