[LTP] [PATCH 1/3] syscalls/alarm02: Rewrite to new library
Cyril Hrubis
chrubis@suse.cz
Wed Jul 25 15:48:29 CEST 2018
Hi!
> +static struct tcase {
> + char *buf;
> + unsigned long int sec;
> +} tcases[] = {
> + {"-1", -1},
> + {"ULONG_MAX", ULONG_MAX},
> + {"ULONG_MAX+1", ULONG_MAX + 1},
> +};
Looking at these values these seems to be a bit bogus, the alarm
prototype is defined with unsigned int, so the only value that makes
sense here would he UINT_MAX.
The -1 == ULONG_MAX when converted to unsigned int and ULONG_MAX + 1
would end up as 0.
Also alarm() returns the number of seconds remaining for the alarm, so
we should really do something as:
* call alarm(UINT_MAX);
* check the return value was 0
* call alarm(0);
* check that the return value was either UINT_MAX or UINT_MAX - 1
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list