aboutsummaryrefslogtreecommitdiff
path: root/ident.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-05-26 10:32:19 -0700
committerJunio C Hamano <gitster@pobox.com>2011-05-26 10:32:19 -0700
commit8784e4dddeb16a89dd19bfb879788b8df0aac1f5 (patch)
treef17a089b6ee0629b4d86566c21247b4b7f34de85 /ident.c
parentce5e95383d2aab5c5a4886c2d5b47e8f1d1989b9 (diff)
parent590e081dea7c064056941bfae28b25ce956585f5 (diff)
downloadgit-8784e4dddeb16a89dd19bfb879788b8df0aac1f5.tar.gz
git-8784e4dddeb16a89dd19bfb879788b8df0aac1f5.tar.xz
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
Diffstat (limited to 'ident.c')
-rw-r--r--ident.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ident.c b/ident.c
index 8e56b5e94..35a6f2647 100644
--- a/ident.c
+++ b/ident.c
@@ -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;