2003-06-26  Roland McGrath  <roland@redhat.com>

	* syscall.c (get_scno) [S390 || S390X]: Fix old vs new mode detection.
	From Michael Holzheu <HOLZHEU@de.ibm.com>.
diff --git a/syscall.c b/syscall.c
index 39ee93c..08d673e 100644
--- a/syscall.c
+++ b/syscall.c
@@ -734,14 +734,6 @@
 
 #ifdef LINUX
 #if defined(S390) || defined(S390X)
-	if (upeek(pid, PT_GPR2, &syscall_mode) < 0)
-		return -1;
-	if (syscall_mode != -ENOSYS) {
-		/*
-		 * Since kernel version 2.5.44 the scno gets passed in gpr2.
-		 */
-		scno = syscall_mode;
-	}
 	if (tcp->flags & TCB_WAITEXECVE) {
 		/*
 		 * When the execve system call completes successfully, the
@@ -761,7 +753,16 @@
 		tcp->flags &= ~TCB_WAITEXECVE;
 		return 0;
 	}
-	else {
+
+	if (upeek(pid, PT_GPR2, &syscall_mode) < 0)
+			return -1;
+
+	if (syscall_mode != -ENOSYS) {
+		/*
+ 		 * Since kernel version 2.5.44 the scno gets passed in gpr2.
+		 */
+		scno = syscall_mode;
+	} else {
 	       	/*
 		 * Old style of "passing" the scno via the SVC instruction.
 		 */