Skip to content

Commit e2327a4

Browse files
committed
ident: stop assuming that gw_gecos is writable
In 590e081 (ident: add NO_GECOS_IN_PWENT for systems without pw_gecos in struct passwd, 2011-05-19), code was introduced to iterate over the `gw_gecos` field; The loop variable is of type `char *`, which assumes that `gw_gecos` is writable. However, it is not necessarily writable (and it is a bad idea to have it writable in the first place), so let's switch the loop variable type to `const char *`. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 981754f commit e2327a4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ident.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static struct passwd *xgetpwuid_self(int *is_bogus)
5959

6060
static void copy_gecos(const struct passwd *w, struct strbuf *name)
6161
{
62-
char *src;
62+
const char *src;
6363

6464
/* Traditionally GECOS field had office phone numbers etc, separated
6565
* with commas. Also & stands for capitalized form of the login name.

0 commit comments

Comments
 (0)