summaryrefslogtreecommitdiff
path: root/emulators/qemu-devel/files/patch-z4-bsd-user-elfload
blob: f1c4ae31ed17171fc8de80cc6f236e7a121679e4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
--- a/bsd-user/elfload.c
+++ b/bsd-user/elfload.c
@@ -812,8 +812,9 @@ static abi_ulong setup_arg_pages(abi_ulo
 	     * Add argv strings.  Note that the argv[] vectors are added by
 	     * loader_build_argptr()
 	     */
-	    i = bprm->argc;
-	    while (i-- > 0) {
+	    // i = bprm->argc;
+	    // while (i-- > 0) {
+	    for (i = 0; i < bprm->argc; ++i) {
 		    size_t len = strlen(bprm->argv[i]) + 1;
 		    /* XXX - check return value of memcpy_to_target(). */
 		    memcpy_to_target(destp, bprm->argv[i], len);
@@ -826,8 +827,9 @@ static abi_ulong setup_arg_pages(abi_ulo
 	     * Add env strings. Note that the envp[] vectors are added by
 	     * loader_build_argptr().
 	     */
-	    i = bprm->envc;
-	    while(i-- > 0) {
+	    // i = bprm->envc;
+	    // while(i-- > 0) {
+	    for (i = 0; i < bprm->envc; ++i) {
 		    size_t len = strlen(bprm->envp[i]) + 1;
 		    /* XXX - check return value of memcpy_to_target(). */
 		    memcpy_to_target(destp, bprm->envp[i], len);