summaryrefslogtreecommitdiff
path: root/sys/src/ape/lib/ap/stdio/_IO_newfile.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2014-05-29 00:34:47 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2014-05-29 00:34:47 +0200
commitca35949c20cee081efe5cda03bfff64167da05d2 (patch)
tree064e22a4acc0d7a6b513926ca46a7fa346f9b682 /sys/src/ape/lib/ap/stdio/_IO_newfile.c
parent52153c32dcc83b2ae752431f7827ddff9b926a78 (diff)
ape/stdio: set errno to EMFILE when running out of streams
Diffstat (limited to 'sys/src/ape/lib/ap/stdio/_IO_newfile.c')
-rw-r--r--sys/src/ape/lib/ap/stdio/_IO_newfile.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/src/ape/lib/ap/stdio/_IO_newfile.c b/sys/src/ape/lib/ap/stdio/_IO_newfile.c
index 6a016ec5d..f559fdf8c 100644
--- a/sys/src/ape/lib/ap/stdio/_IO_newfile.c
+++ b/sys/src/ape/lib/ap/stdio/_IO_newfile.c
@@ -5,6 +5,7 @@
#define _PLAN9_SOURCE
#include <lock.h>
+#include <errno.h>
FILE *_IO_newfile(void)
{
@@ -21,7 +22,9 @@ FILE *_IO_newfile(void)
}
f = fx;
unlock(&fl);
- if(f->state!=CLOSED)
+ if(f->state!=CLOSED){
+ errno = EMFILE;
return NULL;
+ }
return f;
}