Three commits for review

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Three commits for review

I split my large commit from a while back into three smaller ones as requested, to be applied with `git am`.


This fixes buffer overflows in sqUnixFile.c using safer string functions adapted from BSD's strlcpy() and strlcat() and modernizes the #includes to assume a POSIX environment.


This fixes race conditions in sqFileOpen() that could cause accidental file truncation and data loss while still preserving the existing semantics of trying to open the file in increasingly restricted modes after each failure.

It also adds sqFileOpenNew() (to support a new primitive), which opens a new file atomically, failing if it already exists. This is essential (along with fsync and rename) for doing durable file IO from Squeak and Pharo. The Windows part could use review.

The isatty() part that zecke said looked "fishy" is just dead code elimination, removing the `#if 0` branch of an #if/#else/#endif. (There's a larger chunk of dead code above that I left, after the `#if defined(_IOLBF) && 0`)


This just replaces the complex function generating macros with their output (`gcc -E`) to improve identifier searchability.

buffer-overflow-fix.patch (22K) Download Attachment
char-conv-fix.patch (3K) Download Attachment
race-condition-fix.patch (18K) Download Attachment