[LTP] gethostname02: Accept EOVERFLOW on alpha
linuxtestproject.agent@gmail.com
linuxtestproject.agent@gmail.com
Tue Jun 2 10:39:27 CEST 2026
Hi panzhe,
On Tue, 02 Jun 2026 12:17:38 +0800, panzhe <panzhe@kylinos.cn> wrote:
> gethostname02: Accept EOVERFLOW on alpha
> + const int exp_errnos[] = {ENAMETOOLONG, EOVERFLOW};
>
> SAFE_GETHOSTNAME(hostname, sizeof(hostname));
> real_length = strlen(hostname);
>
> - TST_EXP_FAIL(gethostname(hostname, real_length - 1), ENAMETOOLONG,
> + TST_EXP_FAIL2_ARR(gethostname(hostname, real_length - 1),
> + exp_errnos, ARRAY_SIZE(exp_errnos),
> "len is smaller than the actual size");
`gethostname()` returns 0 on success and -1 on error, so this should use
`TST_EXP_FAIL_ARR` rather than `TST_EXP_FAIL2_ARR`. The `TST_EXP_FAIL2`
family is for syscalls that return a positive value on success (e.g.
`open`, `fork`). The original `TST_EXP_FAIL` call already used the
correct family; the array variant should follow suit:
TST_EXP_FAIL_ARR(gethostname(hostname, real_length - 1),
exp_errnos, ARRAY_SIZE(exp_errnos),
"len is smaller than the actual size");
Needs revision.
---
Note:
The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
More information about the ltp
mailing list