diff options
author | Hiltjo Posthuma <[email protected]> | 2016-05-03 20:42:46 +0200 |
---|---|---|
committer | Hiltjo Posthuma <[email protected]> | 2016-05-03 20:42:46 +0200 |
commit | 543582034eed3faf6120de321354f36ec8a2c0b4 (patch) | |
tree | 695f45914afcd648d0b0d93d4330df3d6e99eed7 /stagit-index.c | |
parent | 2d8eb85f01fdb97ab76c538b868128db4c3e99f0 (diff) | |
download | stagit-543582034eed3faf6120de321354f36ec8a2c0b4.tar.gz stagit-543582034eed3faf6120de321354f36ec8a2c0b4.zip |
fix joinpath(): use of global 'repodir', should be 'path'
use joinpath for another case.
Diffstat (limited to 'stagit-index.c')
-rw-r--r-- | stagit-index.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/stagit-index.c b/stagit-index.c index d9f322a..1834d8d 100644 --- a/stagit-index.c +++ b/stagit-index.c @@ -30,6 +30,18 @@ pledge(const char *promises, const char *paths[]) } #endif +void +joinpath(char *buf, size_t bufsiz, const char *path, const char *path2) +{ + int r; + + r = snprintf(buf, bufsiz, "%s%s%s", + path, path[0] && path[strlen(path) - 1] != '/' ? "/" : "", path2); + if (r == -1 || (size_t)r >= bufsiz) + errx(1, "path truncated: '%s%s%s'", + path, path[0] && path[strlen(path) - 1] != '/' ? "/" : "", path2); +} + /* Escape characters below as HTML 2.0 / XML 1.0. */ void xmlencode(FILE *fp, const char *s, size_t len) @@ -139,18 +151,6 @@ err: return ret; } -void -joinpath(char *buf, size_t bufsiz, const char *path, const char *path2) -{ - int r; - - r = snprintf(buf, bufsiz, "%s%s%s", - repodir, path[0] && path[strlen(path) - 1] != '/' ? "/" : "", path2); - if (r == -1 || (size_t)r >= bufsiz) - errx(1, "path truncated: '%s%s%s'", - path, path[0] && path[strlen(path) - 1] != '/' ? "/" : "", path2); -} - int main(int argc, char *argv[]) { |