Ticket #41077: mod_jk.diff

File mod_jk.diff, 2.5 KB (added by girgen@…, 10 years ago)
  • Portfile

    old new  
    44
    55name                            mod_jk
    66version                         1.2.27
     7revision                        1
    78
    89categories                      www java
    910license                         Apache-2 BSD
     
    3940if { [llength [array get env "JAVA_HOME"]] > 0 } {
    4041        set javahome $env(JAVA_HOME)
    4142} else {
    42         set javahome ""
     43        set javahome [exec /usr/libexec/java_home]
    4344}
    4445if { ![file isdirectory ${javahome}] } {
    4546        if { ${os.platform} == "darwin" } {
     
    7273        }
    7374}
    7475
     76patchfiles-append jk_map.c.patch
    7577if {[variant_isset universal]} {
    7678    patchfiles-append   configure_universal.patch
    7779    post-configure {
  • new file files/jk_map.c.patch

    - +  
     1Index: common/jk_map.c
     2===================================================================
     3--- common/jk_map.c     (revision 1535519)
     4+++ common/jk_map.c     (working copy)
     5@@ -183,33 +183,37 @@
     6 
     7 int jk_map_get_int(jk_map_t *m, const char *name, int def)
     8 {
     9-    char buf[100];
     10     const char *rc;
     11-    size_t len;
     12     int int_res;
     13-    int multit = 1;
     14 
     15-    sprintf(buf, "%d", def);
     16-    rc = jk_map_get_string(m, name, buf);
     17+    rc = jk_map_get_string(m, name, NULL);
     18 
     19-    len = strlen(rc);
     20-    if (len) {
     21-        char *lastchar = &buf[0] + len - 1;
     22-        strcpy(buf, rc);
     23-        if ('m' == *lastchar || 'M' == *lastchar) {
     24-            *lastchar = '\0';
     25-            multit = 1024 * 1024;
     26+    if(NULL == rc) {
     27+        int_res = def;
     28+    } else {
     29+        size_t len = strlen(rc);
     30+        int multit = 1;
     31+
     32+        if (len) {
     33+            char buf[100];
     34+            char *lastchar;
     35+            strncpy(buf, rc, 100);
     36+           lastchar = buf + len - 1;
     37+            if ('m' == *lastchar || 'M' == *lastchar) {
     38+                *lastchar = '\0';
     39+                multit = 1024 * 1024;
     40+            }
     41+            else if ('k' == *lastchar || 'K' == *lastchar) {
     42+                *lastchar = '\0';
     43+                multit = 1024;
     44+            }
     45+            int_res = multit * atoi(buf);
     46         }
     47-        else if ('k' == *lastchar || 'K' == *lastchar) {
     48-            *lastchar = '\0';
     49-            multit = 1024;
     50-        }
     51-        int_res = atoi(buf);
     52+        else
     53+            int_res = def;
     54     }
     55-    else
     56-        int_res = def;
     57 
     58-    return int_res * multit;
     59+    return int_res;
     60 }
     61 
     62 double jk_map_get_double(jk_map_t *m, const char *name, double def)