Re: [PATCH v4 10/32] cache.h: define constants LOCK_SUFFIX and LOCK_SUFFIX_LEN

2014-09-12 Thread Ronnie Sahlberg
On Fri, Sep 12, 2014 at 10:13 AM, Michael Haggerty wrote: > On 09/12/2014 12:42 AM, Ronnie Sahlberg wrote: >> Maybe we should not have a public constant defined for the length : >> +#define LOCK_SUFFIX_LEN 5 >> >> since it encourages unsafe code like : (this was unsafe long before >> your patch s

Re: [PATCH v4 10/32] cache.h: define constants LOCK_SUFFIX and LOCK_SUFFIX_LEN

2014-09-12 Thread Michael Haggerty
On 09/12/2014 12:42 AM, Ronnie Sahlberg wrote: > Maybe we should not have a public constant defined for the length : > +#define LOCK_SUFFIX_LEN 5 > > since it encourages unsafe code like : (this was unsafe long before > your patch so not a regression) > + i = strlen(result_file) - LOCK_SUFF

Re: [PATCH v4 10/32] cache.h: define constants LOCK_SUFFIX and LOCK_SUFFIX_LEN

2014-09-12 Thread Michael Haggerty
On 09/12/2014 12:15 AM, Ronnie Sahlberg wrote: > On Sat, Sep 6, 2014 at 12:50 AM, Michael Haggerty > wrote: >> There are a few places that use these values, so define constants for >> them. >> >> Signed-off-by: Michael Haggerty >> --- >> cache.h| 4 >> lockfile.c | 11 ++- >>

Re: [PATCH v4 10/32] cache.h: define constants LOCK_SUFFIX and LOCK_SUFFIX_LEN

2014-09-11 Thread Ronnie Sahlberg
Maybe we should not have a public constant defined for the length : +#define LOCK_SUFFIX_LEN 5 since it encourages unsafe code like : (this was unsafe long before your patch so not a regression) + i = strlen(result_file) - LOCK_SUFFIX_LEN; /* .lock */ result_file[i] = 0; What abo

Re: [PATCH v4 10/32] cache.h: define constants LOCK_SUFFIX and LOCK_SUFFIX_LEN

2014-09-11 Thread Ronnie Sahlberg
On Sat, Sep 6, 2014 at 12:50 AM, Michael Haggerty wrote: > There are a few places that use these values, so define constants for > them. > > Signed-off-by: Michael Haggerty > --- > cache.h| 4 > lockfile.c | 11 ++- > refs.c | 7 --- > 3 files changed, 14 insertions(+)

[PATCH v4 10/32] cache.h: define constants LOCK_SUFFIX and LOCK_SUFFIX_LEN

2014-09-06 Thread Michael Haggerty
There are a few places that use these values, so define constants for them. Signed-off-by: Michael Haggerty --- cache.h| 4 lockfile.c | 11 ++- refs.c | 7 --- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/cache.h b/cache.h index da77094..41d829b 100