[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Lost] [PATCH] ! libc: posix-open hat die Flags bis jetzt in einen const char* geschrieben, das kommt nicht gut Raus
---
src/modules/lib/posix/posix_files.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/src/modules/lib/posix/posix_files.c b/src/modules/lib/posix/posix_files.c
index 7a11985..ada4183 100644
--- a/src/modules/lib/posix/posix_files.c
+++ b/src/modules/lib/posix/posix_files.c
@@ -166,7 +166,7 @@ FILE* fdopen(int fd, const char* mode)
*/
int open(const char* filename, int flags, ...)
{
- char* fopen_flags = " ";
+ char fopen_flags[4];
size_t flags_size = 0;
// Wenn O_CREAT und O_EXCL gleichzeitig gesetzt ist, muessen wir abbrechen
@@ -203,6 +203,9 @@ int open(const char* filename, int flags, ...)
fopen_flags[flags_size++] = 'r';
} else if ((flags & O_WRONLY) && (flags & O_TRUNC)) {
fopen_flags[flags_size++] = 'w';
+ } else if ((flags & O_RDWR) && (flags & O_TRUNC)) {
+ fopen_flags[flags_size++] = 'w';
+ fopen_flags[flags_size++] = '+';
} else if ((flags & O_WRONLY)) {
fopen_flags[flags_size++] = 'r';
fopen_flags[flags_size++] = '+';