semop/semop04.c: fix a bug when running with -i option

If we run semop04 like this: ./semop04 -i 2,
its output will be:

semop04     1  TPASS  :  expected failure - errno = 11 : Resource temporarily unavailable
semop04     2  TPASS  :  expected failure - errno = 11 : Resource temporarily unavailable
semop04     1  TBROK  :  semctl() failed
semop04     2  TBROK  :  Remaining cases broken.

Actually in the second iteration, semctl will return ERANGE. This is
because the val variable will be less than zero in the sceond iteration.

Variable val should be reset to 1 before this actual errno test.

Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
Reviewed-by: Jan Stancek <jstancek@redhat.com>
Reviewed-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
1 file changed