Adam Borowski <kilob...@angband.pl> writes: > On Wed, Jan 26, 2011 at 12:03:52PM +0100, Goswin von Brederlow wrote: >> Shachar Shemesh <shac...@debian.org> writes: >> > I've promised to get a library out there, and here it is. The base URL >> > is https://github.com/Shachar/safewrite, and the actual code is at >> > https://github.com/Shachar/safewrite/blob/master/safewrite.c >> >> Some things I noticed: >> >> That way one could use > [..] >> typedef struct { >> int fd; >> char buffer[PATH_MAX]; >> } safe_t; > > Except, you can't rely on PATH_MAX on any modern system. It's defined in > Linux headers to an arbitrary value to make old code compile, but for > example Hurd folks decided to not define it altogether to make buggy code > fail during compilation rather than on runtime.
Right, so typedef struct { int fd; char buffer[0]; } safe_t; and allocating the struct as big as needed. MfG Goswin -- To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/87mxmn6b4u.fsf@frosties.localnet