ladybird/Libraries
Sergey Bugaev f03e452085 LibC: Sync file position when dropping read ahead buffer
When we flush a FILE, we behave differently depending on whether we reading from
the file or writing to it:

* If we're writing, we actually write out the buffered data.
* If we're reading, we just drop the buffered (read ahead) data.

After flushing, there should be no additional buffered state stdio keeps about a
FILE, compared to what is true about the underlying file. This includes file
position (offset). When flushing writes, this is taken care of automatically,
but dropping the buffer is not enough to achieve that when reading. This commit
fixes that by seeking back explicitly in that case.

One way the problem manifested itself was upon fseek(SEEK_CUR) calls, as the
position of the underlying file was oftentimes different to the logical position
of the FILE. Since FILE::seek() already calls FILE::flush() prior to actually
modifying the position, fixing FILE::flush() to sync the positions is enough to
fix that issue.
2020-05-22 18:58:36 +02:00
..
LibAudio Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibC LibC: Sync file position when dropping read ahead buffer 2020-05-22 18:58:36 +02:00
LibCore LibCore+LibTLS: Don't keep a "ready to write" notifier on all Sockets 2020-05-18 20:16:52 +02:00
LibCrypto Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibDebug Revert "Build: Include headers from LibC, LibM, and LibPthread with -isystem" 2020-05-20 16:24:26 +02:00
LibDesktop LaunchServer: Discover handlers from *.af files, allow launching based on a known handler 2020-05-18 11:27:27 +02:00
LibELF Kernel: Absorb LibBareMetal back into the kernel 2020-05-16 12:00:04 +02:00
LibGemini LibGemini: Implement rendering text/gemini documents to HTML 2020-05-17 16:35:42 +02:00
LibGfx LibGfx: Font, extend fonts to 384 character to support LatinExtendedA 2020-05-21 01:19:42 +02:00
LibGUI LibGUI: Add hook when a context menu is requested on a button 2020-05-22 18:23:02 +02:00
LibHTTP ProtocolServer: Support request headers 2020-05-21 12:27:42 +02:00
LibIPC Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibJS LibJS: Make Array.prototype.{join,toString}() generic 2020-05-22 17:43:44 +02:00
LibLine LibLine: Hide debug output behind SUGGESTIONS_DEBUG define 2020-05-21 22:50:14 +02:00
LibM Revert "Build: Include headers from LibC, LibM, and LibPthread with -isystem" 2020-05-20 16:24:26 +02:00
LibMarkdown Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibPCIDB Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibProtocol ProtocolServer: Support request headers 2020-05-21 12:27:42 +02:00
LibPthread Revert "Build: Include headers from LibC, LibM, and LibPthread with -isystem" 2020-05-20 16:24:26 +02:00
LibTextCodec Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibThread Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibTLS LibTLS: Do not call on_tls_finished until the client has read app data 2020-05-21 01:21:39 +02:00
LibUnwind LibUnwind: Create UnwindBase.h to capture the EH ABI in code 2020-05-14 08:50:10 +02:00
LibVT LibVT: Pass the handler name to Launcher::open_url to control what gets launched 2020-05-18 11:27:27 +02:00
LibWeb LibWeb: Set window object as this value in set{Interval,Timeout}() 2020-05-21 15:18:08 +02:00
LibX86 Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
CMakeLists.txt Revert "LibC: Implement Itanium C++ ABI for static variable guards" 2020-05-20 16:24:26 +02:00