Changeset 3641 for branches


Ignore:
Timestamp:
Dec 24, 2016, 12:56:11 AM (2 years ago)
Author:
bruno
Message:
  • Finalize fix for #644 by removing the last MAX_STR_LEN usage in the function running commands. Everything on the exclude line should now be handle dynamically.
Location:
branches/3.3/mondo/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3/mondo/src/common/libmondo-fork.c

    r3615 r3641  
    253253    /*@ buffer ****************************************************** */
    254254    char *callstr = NULL;
    255     char incoming[MAX_STR_LEN * 2];
     255    char *incoming = NULL;
    256256    char *tmp1 = NULL;
     257    char *tmp2 = NULL;
    257258
    258259    /*@ int ********************************************************* */
     
    307308    fin = fopen(tmp1, "r");
    308309    if (fin) {
    309         for (q = fgets(incoming, MAX_STR_LEN, fin); !feof(fin) && (q != NULL); q = fgets(incoming, MAX_STR_LEN, fin)) {
    310             p = incoming;
    311             while (p && *p) {
    312                 if ((p = strchr(p, '%'))) {
    313                     memmove(p, p + 1, strlen(p) + 1);
    314                     p += 2;
    315                 }
    316             }
    317             strip_spaces(incoming);
     310        for (mr_getline(incoming, fin); !feof(fin); mr_getline(incoming, fin)) {
     311            // Removes % char
     312            tmp2 = mr_stresc(incoming, "%", '\\', '\'');
     313            mr_free(incoming);
     314            incoming = tmp2;
     315
     316            // Remove spaces
     317            tmp2 = mr_strip_spaces(incoming);
     318            mr_free(incoming);
     319            incoming = tmp2;
    318320            if ((res == 0 && log_if_success) || (res != 0 && log_if_failure)) {
    319321                log_msg(0, incoming);
    320322            }
     323            mr_free(incoming);
    321324        }
    322325        paranoid_fclose(fin);
  • branches/3.3/mondo/src/lib/mr_str.c

    r3627 r3641  
    193193}
    194194
     195/*  Subsitute the string token in the string in by the string subst */
    195196char *mr_str_substitute(const char *in, const char *token, const char *subst) {
    196197
     
    205206    return(output);
    206207}
    207 // token found end string here for now
     208// token found: end string here for now
    208209*tmp = '\0';
    209210
Note: See TracChangeset for help on using the changeset viewer.