ifix joinpath(): use of global 'repodir', should be 'path' - stagit-gopher - A git gopher frontend. (mirror) Err bitreich.org 70 hgit clone git://bitreich.org/stagit-gopher/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/stagit-gopher/ URL:git://bitreich.org/stagit-gopher/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/stagit-gopher/ bitreich.org 70 1Log /scm/stagit-gopher/log.gph bitreich.org 70 1Files /scm/stagit-gopher/files.gph bitreich.org 70 1Refs /scm/stagit-gopher/refs.gph bitreich.org 70 1Tags /scm/stagit-gopher/tag bitreich.org 70 1README /scm/stagit-gopher/file/README.gph bitreich.org 70 1LICENSE /scm/stagit-gopher/file/LICENSE.gph bitreich.org 70 i--- Err bitreich.org 70 1commit 543582034eed3faf6120de321354f36ec8a2c0b4 /scm/stagit-gopher/commit/543582034eed3faf6120de321354f36ec8a2c0b4.gph bitreich.org 70 1parent 2d8eb85f01fdb97ab76c538b868128db4c3e99f0 /scm/stagit-gopher/commit/2d8eb85f01fdb97ab76c538b868128db4c3e99f0.gph bitreich.org 70 hAuthor: Hiltjo Posthuma URL:mailto:hiltjo@codemadness.org bitreich.org 70 iDate: Tue, 3 May 2016 20:42:46 +0200 Err bitreich.org 70 i Err bitreich.org 70 ifix joinpath(): use of global 'repodir', should be 'path' Err bitreich.org 70 i Err bitreich.org 70 iuse joinpath for another case. Err bitreich.org 70 i Err bitreich.org 70 iDiffstat: Err bitreich.org 70 i M stagit-index.c | 24 ++++++++++++------------ Err bitreich.org 70 i M stagit.c | 39 ++++++++++++++----------------- Err bitreich.org 70 i Err bitreich.org 70 i2 files changed, 29 insertions(+), 34 deletions(-) Err bitreich.org 70 i--- Err bitreich.org 70 1diff --git a/stagit-index.c b/stagit-index.c /scm/stagit-gopher/file/stagit-index.c.gph bitreich.org 70 i@@ -30,6 +30,18 @@ pledge(const char *promises, const char *paths[]) Err bitreich.org 70 i } Err bitreich.org 70 i #endif Err bitreich.org 70 i Err bitreich.org 70 i+void Err bitreich.org 70 i+joinpath(char *buf, size_t bufsiz, const char *path, const char *path2) Err bitreich.org 70 i+{ Err bitreich.org 70 i+ int r; Err bitreich.org 70 i+ Err bitreich.org 70 i+ r = snprintf(buf, bufsiz, "%s%s%s", Err bitreich.org 70 i+ path, path[0] && path[strlen(path) - 1] != '/' ? "/" : "", path2); Err bitreich.org 70 i+ if (r == -1 || (size_t)r >= bufsiz) Err bitreich.org 70 i+ errx(1, "path truncated: '%s%s%s'", Err bitreich.org 70 i+ path, path[0] && path[strlen(path) - 1] != '/' ? "/" : "", path2); Err bitreich.org 70 i+} Err bitreich.org 70 i+ Err bitreich.org 70 i /* Escape characters below as HTML 2.0 / XML 1.0. */ Err bitreich.org 70 i void Err bitreich.org 70 i xmlencode(FILE *fp, const char *s, size_t len) Err bitreich.org 70 i@@ -139,18 +151,6 @@ err: Err bitreich.org 70 i return ret; Err bitreich.org 70 i } Err bitreich.org 70 i Err bitreich.org 70 i-void Err bitreich.org 70 i-joinpath(char *buf, size_t bufsiz, const char *path, const char *path2) Err bitreich.org 70 i-{ Err bitreich.org 70 i- int r; Err bitreich.org 70 i- Err bitreich.org 70 i- r = snprintf(buf, bufsiz, "%s%s%s", Err bitreich.org 70 i- repodir, path[0] && path[strlen(path) - 1] != '/' ? "/" : "", path2); Err bitreich.org 70 i- if (r == -1 || (size_t)r >= bufsiz) Err bitreich.org 70 i- errx(1, "path truncated: '%s%s%s'", Err bitreich.org 70 i- path, path[0] && path[strlen(path) - 1] != '/' ? "/" : "", path2); Err bitreich.org 70 i-} Err bitreich.org 70 i- Err bitreich.org 70 i int Err bitreich.org 70 i main(int argc, char *argv[]) Err bitreich.org 70 i { Err bitreich.org 70 1diff --git a/stagit.c b/stagit.c /scm/stagit-gopher/file/stagit.c.gph bitreich.org 70 i@@ -77,6 +77,18 @@ pledge(const char *promises, const char *paths[]) Err bitreich.org 70 i #endif Err bitreich.org 70 i Err bitreich.org 70 i void Err bitreich.org 70 i+joinpath(char *buf, size_t bufsiz, const char *path, const char *path2) Err bitreich.org 70 i+{ Err bitreich.org 70 i+ int r; Err bitreich.org 70 i+ Err bitreich.org 70 i+ r = snprintf(buf, bufsiz, "%s%s%s", Err bitreich.org 70 i+ path, path[0] && path[strlen(path) - 1] != '/' ? "/" : "", path2); Err bitreich.org 70 i+ if (r == -1 || (size_t)r >= bufsiz) Err bitreich.org 70 i+ errx(1, "path truncated: '%s%s%s'", Err bitreich.org 70 i+ path, path[0] && path[strlen(path) - 1] != '/' ? "/" : "", path2); Err bitreich.org 70 i+} Err bitreich.org 70 i+ Err bitreich.org 70 i+void Err bitreich.org 70 i deltainfo_free(struct deltainfo *di) Err bitreich.org 70 i { Err bitreich.org 70 i if (!di) Err bitreich.org 70 i@@ -796,17 +808,12 @@ writefilestree(FILE *fp, git_tree *tree, const char *branch, const char *path) Err bitreich.org 70 i if (!(entry = git_tree_entry_byindex(tree, i)) || Err bitreich.org 70 i !(entryname = git_tree_entry_name(entry))) Err bitreich.org 70 i return -1; Err bitreich.org 70 i- r = snprintf(entrypath, sizeof(entrypath), "%s%s%s", Err bitreich.org 70 i- path, path[0] ? "/" : "", entryname); Err bitreich.org 70 i- if (r == -1 || (size_t)r >= sizeof(entrypath)) Err bitreich.org 70 i- errx(1, "path truncated: '%s%s%s'", Err bitreich.org 70 i- path, path[0] ? "/" : "", entryname); Err bitreich.org 70 i- Err bitreich.org 70 i- r = snprintf(filepath, sizeof(filepath), "file/%s%s%s.html", Err bitreich.org 70 i- path, path[0] ? "/" : "", entryname); Err bitreich.org 70 i+ joinpath(entrypath, sizeof(entrypath), path, entryname); Err bitreich.org 70 i+ Err bitreich.org 70 i+ r = snprintf(filepath, sizeof(filepath), "file/%s.html", Err bitreich.org 70 i+ entrypath); Err bitreich.org 70 i if (r == -1 || (size_t)r >= sizeof(filepath)) Err bitreich.org 70 i- errx(1, "path truncated: 'file/%s%s%s.html'", Err bitreich.org 70 i- path, path[0] ? "/" : "", entryname); Err bitreich.org 70 i+ errx(1, "path truncated: 'file/%s.html'", entrypath); Err bitreich.org 70 i Err bitreich.org 70 i if (!git_tree_entry_to_object(&obj, repo, entry)) { Err bitreich.org 70 i switch (git_object_type(obj)) { Err bitreich.org 70 i@@ -991,18 +998,6 @@ err: Err bitreich.org 70 i } Err bitreich.org 70 i Err bitreich.org 70 i void Err bitreich.org 70 i-joinpath(char *buf, size_t bufsiz, const char *path, const char *path2) Err bitreich.org 70 i-{ Err bitreich.org 70 i- int r; Err bitreich.org 70 i- Err bitreich.org 70 i- r = snprintf(buf, bufsiz, "%s%s%s", Err bitreich.org 70 i- repodir, path[0] && path[strlen(path) - 1] != '/' ? "/" : "", path2); Err bitreich.org 70 i- if (r == -1 || (size_t)r >= bufsiz) Err bitreich.org 70 i- errx(1, "path truncated: '%s%s%s'", Err bitreich.org 70 i- path, path[0] && path[strlen(path) - 1] != '/' ? "/" : "", path2); Err bitreich.org 70 i-} Err bitreich.org 70 i- Err bitreich.org 70 i-void Err bitreich.org 70 i usage(char *argv0) Err bitreich.org 70 i { Err bitreich.org 70 i fprintf(stderr, "%s [-c cachefile] repodir\n", argv0); Err bitreich.org 70 .