]> granicus.if.org Git - procps-ng/commitdiff
pmap fix by Jim
authorCraig Small <csmall@enc.com.au>
Wed, 26 Oct 2011 11:25:21 +0000 (22:25 +1100)
committerCraig Small <csmall@enc.com.au>
Wed, 26 Oct 2011 11:25:21 +0000 (22:25 +1100)
contrib/response.filtered-with-patches.err
pmap.c

index ae6cda01b235d6e8dfd3472434fbb08ac25ac01d..6d235e0a3500302bbbf0fae1d859c7aa54c34dbc 100644 (file)
@@ -61,7 +61,7 @@ pgrep.c:558: data_index: Using tainted variable "(int)argv[1][1]" as an index to
 Error: EVALUATION_ORDER:
        agree that there is a problem.
        moreover, it deals with an undocumented command line argument (but sami has documentation addition pending)
-       a deference was added in line with intent, hopefully avoids this warning
+       the logic was altered in line with intent, hopefully avoids this warning
        my_category: defect_was_fixed
 pmap.c:314: write_write_order: In "arg2 = (arg2 ? arg2++ : arg1)", "arg2" is written in "arg2" (the assignment left-hand side) and written in "arg2 ? arg2++ : arg1" but the order in which the side effects take place is undefined because there is no intervening sequence point.
 
diff --git a/pmap.c b/pmap.c
index 9fcaa2af1e64a351ff102827782cd2f094f4c20e..1df1a8520ae4e875daaa4f7a3d91bd45e2b513be 100644 (file)
--- a/pmap.c
+++ b/pmap.c
@@ -311,14 +311,15 @@ int main(int argc, char *argv[]){
             char *arg2 = strchr(arg1,',');
             if(arg2)
               *arg2 = '\0';
-            arg2 = *arg2 ? arg2++ : arg1;
+            if(arg2) ++arg2;
+            else arg2 = arg1;
             
             if(*arg1)
               range_low = STRTOUKL(arg1,&arg1,16);
             if(*arg2)
               range_high = STRTOUKL(arg2,&arg2,16);
             if(*arg1 || *arg2)
-               usage();
+              usage();
           }
           break;
         case 'a': // Sun prints anon/swap reservations