iimprove fopen flag: remove b and r+ in some case - 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 e01336e656582ed0a235b30b549dd8f5e69e860b /scm/stagit-gopher/commit/e01336e656582ed0a235b30b549dd8f5e69e860b.gph bitreich.org 70 1parent 2ab268d5b1c6da916e3e03d547e39711c2f4fd87 /scm/stagit-gopher/commit/2ab268d5b1c6da916e3e03d547e39711c2f4fd87.gph bitreich.org 70 hAuthor: Hiltjo Posthuma URL:mailto:hiltjo@codemadness.org bitreich.org 70 iDate: Sun, 20 Dec 2015 17:10:07 +0100 Err bitreich.org 70 i Err bitreich.org 70 iimprove fopen flag: remove b and r+ in some case Err bitreich.org 70 i Err bitreich.org 70 idon't require rw rights for just reading Err bitreich.org 70 i Err bitreich.org 70 iDiffstat: Err bitreich.org 70 i M urmoms.c | 14 +++++++------- Err bitreich.org 70 i Err bitreich.org 70 i1 file changed, 7 insertions(+), 7 deletions(-) Err bitreich.org 70 i--- Err bitreich.org 70 1diff --git a/urmoms.c b/urmoms.c /scm/stagit-gopher/file/urmoms.c.gph bitreich.org 70 i@@ -337,7 +337,7 @@ printshowfile(struct commitinfo *ci) Err bitreich.org 70 i if (!access(path, F_OK)) Err bitreich.org 70 i return; Err bitreich.org 70 i Err bitreich.org 70 i- fp = efopen(path, "w+b"); Err bitreich.org 70 i+ fp = efopen(path, "w"); Err bitreich.org 70 i writeheader(fp); Err bitreich.org 70 i fputs("
\n", fp);	Err	bitreich.org	70
i         printcommit(fp, ci);	Err	bitreich.org	70
i@@ -590,7 +590,7 @@ writeblob(const git_index_entry *entry)	Err	bitreich.org	70
i         }	Err	bitreich.org	70
i         relpath = tmp;	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-        fp = efopen(fpath, "w+b");	Err	bitreich.org	70
i+        fp = efopen(fpath, "w");	Err	bitreich.org	70
i         writeheader(fp);	Err	bitreich.org	70
i         fprintf(fp, "

%s (%" PRIu32 "b)


", entry->path, entry->file_size); Err bitreich.org 70 i if (git_blob_is_binary((git_blob *)obj)) { Err bitreich.org 70 i@@ -676,10 +676,10 @@ main(int argc, char *argv[]) Err bitreich.org 70 i /* read description or .git/description */ Err bitreich.org 70 i snprintf(path, sizeof(path), "%s%s%s", Err bitreich.org 70 i repodir, repodir[strlen(repodir)] == '/' ? "" : "/", "description"); Err bitreich.org 70 i- if (!(fpread = fopen(path, "r+b"))) { Err bitreich.org 70 i+ if (!(fpread = fopen(path, "r"))) { Err bitreich.org 70 i snprintf(path, sizeof(path), "%s%s%s", Err bitreich.org 70 i repodir, repodir[strlen(repodir)] == '/' ? "" : "/", ".git/description"); Err bitreich.org 70 i- fpread = fopen(path, "r+b"); Err bitreich.org 70 i+ fpread = fopen(path, "r"); Err bitreich.org 70 i } Err bitreich.org 70 i if (fpread) { Err bitreich.org 70 i if (!fgets(description, sizeof(description), fpread)) Err bitreich.org 70 i@@ -694,20 +694,20 @@ main(int argc, char *argv[]) Err bitreich.org 70 i hasreadme = !git_revparse_single(&obj, repo, "HEAD:README"); Err bitreich.org 70 i git_object_free(obj); Err bitreich.org 70 i Err bitreich.org 70 i- fp = efopen("log.html", "w+b"); Err bitreich.org 70 i+ fp = efopen("log.html", "w"); Err bitreich.org 70 i writeheader(fp); Err bitreich.org 70 i writelog(fp); Err bitreich.org 70 i writefooter(fp); Err bitreich.org 70 i fclose(fp); Err bitreich.org 70 i Err bitreich.org 70 i- fp = efopen("files.html", "w+b"); Err bitreich.org 70 i+ fp = efopen("files.html", "w"); Err bitreich.org 70 i writeheader(fp); Err bitreich.org 70 i writefiles(fp); Err bitreich.org 70 i writefooter(fp); Err bitreich.org 70 i fclose(fp); Err bitreich.org 70 i Err bitreich.org 70 i /* Atom feed */ Err bitreich.org 70 i- fp = efopen("atom.xml", "w+b"); Err bitreich.org 70 i+ fp = efopen("atom.xml", "w"); Err bitreich.org 70 i writeatom(fp); Err bitreich.org 70 i fclose(fp); Err bitreich.org 70 i Err bitreich.org 70 .