projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[PATCH] Debian: build-depend on "bc"
[git.git]
/
path.c
diff --git
a/path.c
b/path.c
index
7ef0d1b
..
f788028
100644
(file)
--- a/
path.c
+++ b/
path.c
@@
-41,10
+41,12
@@
char *mkpath(const char *fmt, ...)
char *git_path(const char *fmt, ...)
{
char *git_path(const char *fmt, ...)
{
- const char *git_dir
= gitenv(GIT_DIR_ENVIRONMENT) ? : DEFAULT_GIT_DIR_ENVIRONMENT
;
+ const char *git_dir;
va_list args;
unsigned len;
va_list args;
unsigned len;
+ git_dir = getenv(GIT_DIR_ENVIRONMENT);
+ if (!git_dir) git_dir = DEFAULT_GIT_DIR_ENVIRONMENT;
len = strlen(git_dir);
if (len > PATH_MAX-100)
return bad_path;
len = strlen(git_dir);
if (len > PATH_MAX-100)
return bad_path;
@@
-68,8
+70,13
@@
int git_mkstemp(char *path, size_t len, const char *template)
if ((env = getenv("TMPDIR")) == NULL) {
strcpy(pch, "/tmp/");
len -= 5;
if ((env = getenv("TMPDIR")) == NULL) {
strcpy(pch, "/tmp/");
len -= 5;
- } else
- len -= snprintf(pch, len, "%s/", env);
+ pch += 5;
+ } else {
+ size_t n = snprintf(pch, len, "%s/", env);
+
+ len -= n;
+ pch += n;
+ }
safe_strncpy(pch, template, len);
safe_strncpy(pch, template, len);