summaryrefslogtreecommitdiff
path: root/firmware/common
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/common')
-rw-r--r--firmware/common/file.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/firmware/common/file.c b/firmware/common/file.c
index c5f4cd5f5e..2c00c3e3f6 100644
--- a/firmware/common/file.c
+++ b/firmware/common/file.c
@@ -122,6 +122,14 @@ int open(char* pathname, int flags)
122 122
123int close(int fd) 123int close(int fd)
124{ 124{
125 if (fd < 0 || fd > MAX_OPEN_FILES-1) {
126 errno = EINVAL;
127 return -1;
128 }
129 if (!openfiles[fd].busy) {
130 errno = EBADF;
131 return -1;
132 }
125 openfiles[fd].busy = false; 133 openfiles[fd].busy = false;
126 return 0; 134 return 0;
127} 135}