Merge branch 'rg/no-gecos-in-pwent'

* rg/no-gecos-in-pwent:
  ident: add NO_GECOS_IN_PWENT for systems without pw_gecos in struct passwd

Conflicts:
	Makefile
This commit is contained in:
Junio C Hamano
2011-05-26 10:32:19 -07:00
2 changed files with 10 additions and 1 deletions

View File

@ -9,6 +9,12 @@
static char git_default_date[50];
#ifdef NO_GECOS_IN_PWENT
#define get_gecos(ignored) "&"
#else
#define get_gecos(struct_passwd) ((struct_passwd)->pw_gecos)
#endif
static void copy_gecos(const struct passwd *w, char *name, size_t sz)
{
char *src, *dst;
@ -20,7 +26,7 @@ static void copy_gecos(const struct passwd *w, char *name, size_t sz)
* with commas. Also & stands for capitalized form of the login name.
*/
for (len = 0, dst = name, src = w->pw_gecos; len < sz; src++) {
for (len = 0, dst = name, src = get_gecos(w); len < sz; src++) {
int ch = *src;
if (ch != '&') {
*dst++ = ch;