| 127 | } |
| 128 | |
| 129 | static void add_domainname(struct strbuf *out, int *is_bogus) |
| 130 | { |
| 131 | char buf[HOST_NAME_MAX + 1]; |
| 132 | |
| 133 | if (xgethostname(buf, sizeof(buf))) { |
| 134 | warning_errno("cannot get host name"); |
| 135 | strbuf_addstr(out, "(none)"); |
| 136 | *is_bogus = 1; |
| 137 | return; |
| 138 | } |
| 139 | if (strchr(buf, '.')) |
| 140 | strbuf_addstr(out, buf); |
| 141 | else if (canonical_name(buf, out) < 0) { |
| 142 | strbuf_addf(out, "%s.(none)", buf); |
| 143 | *is_bogus = 1; |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | static void copy_email(const struct passwd *pw, struct strbuf *email, |
| 148 | int *is_bogus) |
no test coverage detected