mirror of
https://github.com/git/git
synced 2024-11-04 16:17:49 +00:00
ident: add casts for fallback name and GECOS
In `xgetpwuid_self()`, we return a fallback identity when it was not possible to look up the current identity. This fallback identity needs to be internal and must never be written to by the calles as specified by getpwuid(3P). As both the `pw_name` and `pw_gecos` fields are marked as non-constant though, it will cause a warning to assign constant strings to them once compiling with `-Wwrite-strings`. Add explicit casts to avoid the warning. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
b31607a3e0
commit
32f9929109
1 changed files with 2 additions and 2 deletions
4
ident.c
4
ident.c
|
@ -46,9 +46,9 @@ static struct passwd *xgetpwuid_self(int *is_bogus)
|
|||
pw = getpwuid(getuid());
|
||||
if (!pw) {
|
||||
static struct passwd fallback;
|
||||
fallback.pw_name = "unknown";
|
||||
fallback.pw_name = (char *) "unknown";
|
||||
#ifndef NO_GECOS_IN_PWENT
|
||||
fallback.pw_gecos = "Unknown";
|
||||
fallback.pw_gecos = (char *) "Unknown";
|
||||
#endif
|
||||
pw = &fallback;
|
||||
if (is_bogus)
|
||||
|
|
Loading…
Reference in a new issue