From c8d6dfd878cf467cd263145f3195f85a2eed9706 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Sat, 18 Jun 2016 12:09:28 -0700 Subject: perms-hook: Move ".perms" to a define --- util/perms-hook.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'util') diff --git a/util/perms-hook.c b/util/perms-hook.c index 08605cf7..a5792e4d 100644 --- a/util/perms-hook.c +++ b/util/perms-hook.c @@ -28,6 +28,8 @@ directories. #include #include +#define PERMS_FILE ".perms" + struct perm { mode_t mode; char *name; @@ -86,7 +88,7 @@ spawn(char **argv, pid_t *pid) static void readperms(void) { - static char *argv[] = {"git", "show", ":.perms", 0}; + static char *argv[] = {"git", "show", ":" PERMS_FILE, 0}; FILE *f; pid_t pid; char *line = NULL, *s, *mode; @@ -101,7 +103,7 @@ readperms(void) mode = s = line; s = strchr(s, ' '); if (!s || s == mode) - die("malformed .perms file"); + die("malformed permissions file: %s", PERMS_FILE); *s++ = '\0'; perms = realloc(perms, (perms_len + 1) * sizeof(*perms)); if (!perms) @@ -221,7 +223,7 @@ readchanges(char *old, char *new) f = spawn(old ? argv_diff : argv_new, &pid); nextline: while (getdelim(&line, &size, '\0', f) >= 0) { - if (strcmp(line, ".perms") == 0) { + if (strcmp(line, PERMS_FILE) == 0) { specialperms(); continue; } -- cgit v1.2.3