libc: update seek state on opening O_APPEND fds

If a fd is opened in append mode and just is to be used (so never written by
the parent component) for the to be forked child, the seek state was not
pointing to the end of the file.  The wrong seek value then was used in
File_descriptor_allocator::generate_info().

Issue 
This commit is contained in:
Alexander Boettcher 2021-01-20 09:28:14 +01:00 committed by Norman Feske
parent 5fa91c573b
commit 9d239957bc

View File

@ -555,6 +555,9 @@ __SYS_(int, open, (const char *pathname, int flags, ...),
return -1;
new_fdo->path(resolved_path.base());
if (flags & O_APPEND)
lseek(new_fdo->libc_fd, 0, SEEK_END);
return new_fdo->libc_fd;
})