about summary refs log tree commit diff
path: root/src/stdio
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdio')
-rw-r--r--src/stdio/__fdopen.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/stdio/__fdopen.c b/src/stdio/__fdopen.c
index a2ca62b1..a6ae73a2 100644
--- a/src/stdio/__fdopen.c
+++ b/src/stdio/__fdopen.c
@@ -32,7 +32,8 @@ FILE *__fdopen(int fd, const char *mode)
 	/* Set append mode on fd if opened for append */
 	if (*mode == 'a') {
 		int flags = __syscall(SYS_fcntl, fd, F_GETFL);
-		__syscall(SYS_fcntl, fd, F_SETFL, flags | O_APPEND);
+		if (!(flags & O_APPEND))
+			__syscall(SYS_fcntl, fd, F_SETFL, flags | O_APPEND);
 		f->flags |= F_APP;
 	}