<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Sep 7, 2021 at 8:41 PM Zhao Gongyi <<a href="mailto:zhaogongyi@huawei.com">zhaogongyi@huawei.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">When fork() failed and transfer the return value(-1) to kill(),<br>
kill(-1, SIGSTOP) would freeze the system, so it is very serious<br>
in this cases and should be avoided.<br>
<br>
Signed-off-by: Zhao Gongyi <<a href="mailto:zhaogongyi@huawei.com" target="_blank">zhaogongyi@huawei.com</a>><br>
---<br>
 .../conformance/interfaces/clock_nanosleep/1-5.c               | 3 +++<br>
 .../conformance/interfaces/nanosleep/3-2.c                     | 3 +++<br>
 .../conformance/interfaces/sigaction/10-1.c                    | 3 +++<br>
 .../conformance/interfaces/sigaction/11-1.c                    | 3 +++<br>
 .../conformance/interfaces/sigaction/9-1.c                     | 3 +++<br>
 5 files changed, 15 insertions(+)<br>
<br>
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/1-5.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/1-5.c<br>
index 46f26163d..a87585884 100644<br>
--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/1-5.c<br>
+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/1-5.c<br>
@@ -48,6 +48,9 @@ int main(void)<br>
                        return CHILDFAIL;<br>
                }<br>
                return CHILDFAIL;<br>
+       } else if (pid < 0) {<br>
+               printf("fork() did not return success\n");<br>
+               return PTS_UNRESOLVED;<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">Can we do the error check following the fork() instantly?</div><div class="gmail_default" style="font-size:small">Insert pid<0 with a 'else if' looks a bit strange here.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Normally convention like:</div><div class="gmail_default" style="font-size:small"> </div><div class="gmail_default" style="font-size:small">pid = fork();</div><div class="gmail_default" style="font-size:small"> if (pid < 0)</div><div class="gmail_default" style="font-size:small">    do error handle ...</div></div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>