open_posix: Add failure handling of fork()
Hi Li,
I have modified the patch as your review, please see: https://patchwork.ozlabs.org/project/ltp/patch/[email protected]/
Thanks so much!
发件人: Li Wang [mailto:[email protected]]
发送时间: 2021年9月8日 11:30
收件人: zhaogongyi <[email protected]>
抄送: LTP List <[email protected]>
主题: Re: [LTP] [PATCH] open_posix: Add failure handling of fork()
On Tue, Sep 7, 2021 at 8:41 PM Zhao Gongyi <[email protected]<mailto:[email protected]>> wrote:
When fork() failed and transfer the return value(-1) to kill(),kill(-1, SIGSTOP) would freeze the system, so it is very serious
in this cases and should be avoided.
--- .../conformance/interfaces/clock_nanosleep/1-5.c | 3 +++ .../conformance/interfaces/nanosleep/3-2.c | 3 +++ .../conformance/interfaces/sigaction/10-1.c | 3 +++ .../conformance/interfaces/sigaction/11-1.c | 3 +++ .../conformance/interfaces/sigaction/9-1.c | 3 +++ 5 files changed, 15 insertions(+)
testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/1-5.c +3 -0
@@ -48,6 +48,9 @@ int main(void)return CHILDFAIL ; }return CHILDFAIL ; + }else if (pid <0 ) { +printf ("fork() did not return success\n" ); +return PTS_UNRESOLVED ;
Can we do the error check following the fork() instantly? Insert pid<0 with a 'else if' looks a bit strange here.
Normally convention like:
pid = fork();
if (pid < 0)
do error handle ...
--
Regards,
Li Wang
Signature · 2 lines
-- Mailing list info: https://lists.linux.it/listinfo/ltp