[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Safe file update library ready (sort of)



On Wed, Jan 26, 2011 at 12:03:52PM +0100, Goswin von Brederlow wrote:
> Shachar Shemesh <shachar@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.

-- 
1KB		// Microsoft corollary to Hanlon's razor:
		//	Never attribute to stupidity what can be
		//	adequately explained by malice.


Reply to: