X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=builtin-init-db.c;h=d1fa12a59efb34256b2cc80b03c637cc844d84ff;hb=7f5a68ad4d0e00eb2f28405946ec0f2691d7ad81;hp=8199e5d4d5168859363b7a644535fd0cb01a1441;hpb=5a688fe4706462dfa0a7932ef0c82c335c47e9ab;p=git.git diff --git a/builtin-init-db.c b/builtin-init-db.c index 8199e5d4d..d1fa12a59 100644 --- a/builtin-init-db.c +++ b/builtin-init-db.c @@ -122,16 +122,17 @@ static void copy_templates(const char *template_dir) template_dir = system_path(DEFAULT_GIT_TEMPLATE_DIR); if (!template_dir[0]) return; + template_len = strlen(template_dir); + if (PATH_MAX <= (template_len+strlen("/config"))) + die("insanely long template path %s", template_dir); strcpy(template_path, template_dir); - template_len = strlen(template_path); if (template_path[template_len-1] != '/') { template_path[template_len++] = '/'; template_path[template_len] = 0; } dir = opendir(template_path); if (!dir) { - fprintf(stderr, "warning: templates not found %s\n", - template_dir); + warning("templates not found %s", template_dir); return; } @@ -144,8 +145,8 @@ static void copy_templates(const char *template_dir) if (repository_format_version && repository_format_version != GIT_REPO_VERSION) { - fprintf(stderr, "warning: not copying templates of " - "a wrong format version %d from '%s'\n", + warning("not copying templates of " + "a wrong format version %d from '%s'", repository_format_version, template_dir); closedir(dir);