diff options
| author | Michael Forney <mforney@mforney.org> | 2016-06-18 12:09:28 -0700 |
|---|---|---|
| committer | Michael Forney <mforney@mforney.org> | 2016-06-18 12:09:28 -0700 |
| commit | c8d6dfd878cf467cd263145f3195f85a2eed9706 (patch) | |
| tree | d8eedfaad705e953785edde3a3784a67ec7726ac /util | |
| parent | e0c92bf278fbc4271ca6b8bec4211959309a4aa0 (diff) | |
perms-hook: Move ".perms" to a define
Diffstat (limited to 'util')
| -rw-r--r-- | util/perms-hook.c | 8 |
1 files changed, 5 insertions, 3 deletions
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 <sys/wait.h> #include <unistd.h> +#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; } |
