diff options
Diffstat (limited to 'firmware/common/file.c')
-rw-r--r-- | firmware/common/file.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/firmware/common/file.c b/firmware/common/file.c index 82a33ada2d..6d60595ab1 100644 --- a/firmware/common/file.c +++ b/firmware/common/file.c | |||
@@ -83,17 +83,13 @@ int open(const char* pathname, int flags) | |||
83 | errno = EMFILE; | 83 | errno = EMFILE; |
84 | return -2; | 84 | return -2; |
85 | } | 85 | } |
86 | memset(&openfiles[fd], 0, sizeof (struct filedesc)); | ||
86 | 87 | ||
87 | if (flags & O_RDONLY) { | 88 | if (flags & (O_RDWR | O_WRONLY)) { |
88 | openfiles[fd].write = false; | 89 | openfiles[fd].write = true; |
89 | } | 90 | |
90 | else { | 91 | if (flags & O_TRUNC) |
91 | if (flags & (O_RDWR | O_WRONLY)) { | 92 | openfiles[fd].trunc = true; |
92 | openfiles[fd].write = true; | ||
93 | |||
94 | if (flags & O_TRUNC) | ||
95 | openfiles[fd].trunc = true; | ||
96 | } | ||
97 | } | 93 | } |
98 | openfiles[fd].busy = true; | 94 | openfiles[fd].busy = true; |
99 | 95 | ||