diff --git a/Makefile b/Makefile index 4541788e50..ad880d1fc5 100644 --- a/Makefile +++ b/Makefile @@ -2284,7 +2284,7 @@ exec-cmd.sp exec-cmd.s exec-cmd.o: EXTRA_CPPFLAGS = \ '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \ '-DGIT_LOCALE_PATH="$(localedir_relative_SQ)"' \ '-DBINDIR="$(bindir_relative_SQ)"' \ - '-DPREFIX="$(prefix_SQ)"' + '-DFALLBACK_RUNTIME_PREFIX="$(prefix_SQ)"' builtin/init-db.sp builtin/init-db.s builtin/init-db.o: GIT-PREFIX builtin/init-db.sp builtin/init-db.s builtin/init-db.o: EXTRA_CPPFLAGS = \ diff --git a/exec-cmd.c b/exec-cmd.c index 3b0a039083..02d31ee897 100644 --- a/exec-cmd.c +++ b/exec-cmd.c @@ -48,7 +48,7 @@ static const char *system_prefix(void) !(prefix = strip_path_suffix(executable_dirname, GIT_EXEC_PATH)) && !(prefix = strip_path_suffix(executable_dirname, BINDIR)) && !(prefix = strip_path_suffix(executable_dirname, "git"))) { - prefix = PREFIX; + prefix = FALLBACK_RUNTIME_PREFIX; trace_printf("RUNTIME_PREFIX requested, " "but prefix computation failed. " "Using static fallback '%s'.\n", prefix); @@ -243,7 +243,7 @@ void git_resolve_executable_dir(const char *argv0) */ static const char *system_prefix(void) { - return PREFIX; + return FALLBACK_RUNTIME_PREFIX; } /* diff --git a/gettext.c b/gettext.c index baba28343c..7272771c8e 100644 --- a/gettext.c +++ b/gettext.c @@ -159,15 +159,23 @@ static void init_gettext_charset(const char *domain) void git_setup_gettext(void) { const char *podir = getenv(GIT_TEXT_DOMAIN_DIR_ENVIRONMENT); + char *p = NULL; if (!podir) - podir = system_path(GIT_LOCALE_PATH); + podir = p = system_path(GIT_LOCALE_PATH); + + if (!is_directory(podir)) { + free(p); + return; + } bindtextdomain("git", podir); setlocale(LC_MESSAGES, ""); setlocale(LC_TIME, ""); init_gettext_charset("git"); textdomain("git"); + + free(p); } /* return the number of columns of string 's' in current locale */ diff --git a/sideband.c b/sideband.c index 6d7f943e43..325bf0e974 100644 --- a/sideband.c +++ b/sideband.c @@ -13,7 +13,7 @@ * the remote died unexpectedly. A flush() concludes the stream. */ -#define PREFIX "remote: " +#define DISPLAY_PREFIX "remote: " #define ANSI_SUFFIX "\033[K" #define DUMB_SUFFIX " " @@ -49,7 +49,7 @@ int recv_sideband(const char *me, int in_stream, int out) switch (band) { case 3: strbuf_addf(&outbuf, "%s%s%s", outbuf.len ? "\n" : "", - PREFIX, buf + 1); + DISPLAY_PREFIX, buf + 1); retval = SIDEBAND_REMOTE_ERROR; break; case 2: @@ -67,7 +67,7 @@ int recv_sideband(const char *me, int in_stream, int out) int linelen = brk - b; if (!outbuf.len) - strbuf_addstr(&outbuf, PREFIX); + strbuf_addstr(&outbuf, DISPLAY_PREFIX); if (linelen > 0) { strbuf_addf(&outbuf, "%.*s%s%c", linelen, b, suffix, *brk); @@ -81,8 +81,8 @@ int recv_sideband(const char *me, int in_stream, int out) } if (*b) - strbuf_addf(&outbuf, "%s%s", - outbuf.len ? "" : PREFIX, b); + strbuf_addf(&outbuf, "%s%s", outbuf.len ? + "" : DISPLAY_PREFIX, b); break; case 1: write_or_die(out, buf + 1, len);