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 mhag...@alum.mit.edu wrote: There are a few places that use these values, so define constants for them. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- cache.h| 4

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) -

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 mhag...@alum.mit.edu 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

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 mhag...@alum.mit.edu wrote: There are a few places that use these values, so define constants for them. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- cache.h| 4 lockfile.c | 11 ++- refs.c | 7 --- 3

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

[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 mhag...@alum.mit.edu --- 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