According to the posix IEEE Std 1003.1-2008:Upon successful completion,
sigset() shall return SIG_HOLD if the signal had been blocked and the
signal's previous disposition if it had not been blocked.

In these two test instances, the first time when sigset() is called, it
then calls the __sigprocmask() to mask the signal to SIG_BLOCK and checks
the old set to see if the signal was blocked previously, and it's not.
So it will not return SIG_HOLD, but the sigset() already runs successfully.

Then, after the first time we calls the sigset, the signal has already be
blocked, and now, calls the sigset() second, it will return SIG_HOLD, since
the signal had been blocked when we called the sigset() first time.

Signed-off-by: Wanlong Gao <[email protected]>
---
 .../conformance/interfaces/sigset/6-1.c            |   11 +++++++++--
 .../conformance/interfaces/sigset/7-1.c            |   11 +++++++++--
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigset/6-1.c 
b/testcases/open_posix_testsuite/conformance/interfaces/sigset/6-1.c
index 551cc31..4131fee 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigset/6-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigset/6-1.c
@@ -21,6 +21,7 @@
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <errno.h>
 #include "posixtest.h"
 
 void myhandler(int signo)
@@ -41,7 +42,13 @@ int main()
                        return PTS_UNRESOLVED;
         }
 
-        if (sigset(SIGCHLD,SIG_HOLD) != SIG_HOLD) {
+       sigset(SIGCHLD, SIG_HOLD);
+       if (errno != 0 ) {
+               perror("Unexpected error while using sigset()");
+               return PTS_UNRESOLVED;
+       }
+
+        if (sigset(SIGCHLD, SIG_HOLD) != SIG_HOLD) {
                 perror("Unexpected error while using sigset()");
                        return PTS_UNRESOLVED;
         }
@@ -59,4 +66,4 @@ int main()
        }
 
        return PTS_PASS;
-}
\ No newline at end of file
+}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigset/7-1.c 
b/testcases/open_posix_testsuite/conformance/interfaces/sigset/7-1.c
index bdb26c8..5bc159e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigset/7-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigset/7-1.c
@@ -23,6 +23,7 @@
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <errno.h>
 #include "posixtest.h"
 
 int handler_called = 0;
@@ -46,7 +47,13 @@ int main()
                        return PTS_UNRESOLVED;
         }
 
-        if (sigset(SIGCHLD,SIG_HOLD) != SIG_HOLD) {
+       sigset(SIGCHLD, SIG_HOLD);
+       if (errno != 0 ) {
+               perror("Unexpected error while using sigset()");
+               return PTS_UNRESOLVED;
+       }
+
+        if (sigset(SIGCHLD, SIG_HOLD) != SIG_HOLD) {
                 perror("Unexpected error while using sigset()");
                        return PTS_UNRESOLVED;
         }
@@ -70,4 +77,4 @@ int main()
                return PTS_FAIL;
        }
        return PTS_PASS;
-}
\ No newline at end of file
+}
-- 
1.7.6


------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to