static void copy_email(const struct passwd *pw, struct strbuf *email, int *is_bogus) { /* * Make up a fake email address * (name + '@' + hostname [+ '.' + domainname]) */ strbuf_addstr(email, pw->pw_name); strbuf_addch(email, '@'); if (!add_mailname_host(email)) return; /* read from "/etc/mailname" (Debian) */ add_domainname(email, is_bogus); }
static void copy_email(const struct passwd *pw) { /* * Make up a fake email address * (name + '@' + hostname [+ '.' + domainname]) */ size_t len = strlen(pw->pw_name); if (len > sizeof(git_default_email)/2) die("Your sysadmin must hate you!"); memcpy(git_default_email, pw->pw_name, len); git_default_email[len++] = '@'; if (!add_mailname_host(git_default_email + len, sizeof(git_default_email) - len)) return; /* read from "/etc/mailname" (Debian) */ add_domainname(git_default_email + len, sizeof(git_default_email) - len); }