From ca35949c20cee081efe5cda03bfff64167da05d2 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Thu, 29 May 2014 00:34:47 +0200 Subject: ape/stdio: set errno to EMFILE when running out of streams --- sys/src/ape/lib/ap/stdio/_IO_newfile.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sys/src/ape/lib/ap/stdio/_IO_newfile.c') 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 +#include 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; } -- cgit v1.2.3