Fix non-literal format in printf-style calls
These were found using gcc 4.3.2-1ubuntu11 with the warning:
warning: format not a string literal and no format arguments
Incorporated suggestions from Brandon Casey <casey@nrlssc.navy.mil>.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
989206f535
commit
9db56f71b9
4
path.c
4
path.c
@ -41,7 +41,7 @@ char *mksnpath(char *buf, size_t n, const char *fmt, ...)
|
||||
len = vsnprintf(buf, n, fmt, args);
|
||||
va_end(args);
|
||||
if (len >= n) {
|
||||
snprintf(buf, n, bad_path);
|
||||
strlcpy(buf, bad_path, n);
|
||||
return buf;
|
||||
}
|
||||
return cleanup_path(buf);
|
||||
@ -63,7 +63,7 @@ static char *git_vsnpath(char *buf, size_t n, const char *fmt, va_list args)
|
||||
goto bad;
|
||||
return cleanup_path(buf);
|
||||
bad:
|
||||
snprintf(buf, n, bad_path);
|
||||
strlcpy(buf, bad_path, n);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user