Ignore:
Timestamp:
Aug 18, 2009, 3:25:29 PM (15 years ago)
Author:
Bruno Cornec
Message:

r3342@localhost: bruno | 2009-08-14 00:46:51 +0200

  • Another round of strcpy suppressions
  • find_home_of_exe() now allocates memory which has to be freed by the caller
  • Supress useless sz_last_suffix()
  • mr_getline now has the same interface as the other mr_mem functions
  • valgrind and compiler warnings fixes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mondo/src/mondorestore/mondo-rstr-tools.c

    r2329 r2331  
    390390            mr_strcat(additional_parameters, "-o ro");
    391391        }
    392         if (find_home_of_exe("setfattr")) {
     392        tmp = find_home_of_exe("setfattr");
     393        if (tmp) {
    393394            mr_strcat(additional_parameters, ",user_xattr");
    394395        }
    395         if (find_home_of_exe("setfacl")) {
     396        mr_free(tmp);
     397
     398        tmp = find_home_of_exe("setfacl");
     399        if (tmp) {
    396400            mr_strcat(additional_parameters, ",acl");
    397401        }
     402        mr_free(tmp);
    398403    }
    399404
     
    870875    mr_asprintf(g_getfacl,"setfacl");
    871876    log_msg(1, "We will restore ACLs");
    872     if (! find_home_of_exe("setfacl")) {
     877    tmp = find_home_of_exe("setfacl");
     878    if (!tmp) {
    873879        log_msg(1, "Unable to restore ACLs as no setfacl found");
    874880    }
     881    mr_free(tmp);
    875882}
    876883mr_free(value);
     
    880887    mr_asprintf(g_getfattr,"setfattr");
    881888    log_msg(1, "We will restore XATTRs");
    882     if (! find_home_of_exe("setfattr")) {
     889    tmp = find_home_of_exe("setfattr");
     890    if (!tmp) {
    883891        log_msg(1, "Unable to restore XATTRs as no setfattr found");
    884892    }
     893    mr_free(tmp);
    885894}
    886895mr_free(value);
     
    14371446 * @note The returned string points to static storage that will be overwritten with each call.
    14381447 */
    1439 char *find_my_editor(void)
    1440 {
     1448char *find_my_editor(void) {
     1449   
     1450    char *tmp = NULL;
    14411451    static char output[MAX_STR_LEN];
    1442     if (find_home_of_exe("pico")) {
     1452
     1453    tmp = find_home_of_exe("pico");
     1454    if (tmp) {
    14431455        strcpy(output, "pico");
    1444     } else if (find_home_of_exe("nano")) {
    1445         strcpy(output, "nano");
    1446     } else if (find_home_of_exe("e3em")) {
    1447         strcpy(output, "e3em");
    1448     } else if (find_home_of_exe("e3vi")) {
    1449         strcpy(output, "e3vi");
    1450     } else {
    1451         strcpy(output, "vi");
    1452     }
    1453     if (!find_home_of_exe(output)) {
     1456    } else {
     1457        mr_free(tmp);
     1458        tmp = find_home_of_exe("nano");
     1459        if (tmp) {
     1460            strcpy(output, "nano");
     1461        } else {
     1462            mr_free(tmp);
     1463            tmp = find_home_of_exe("joe");
     1464            if (tmp) {
     1465                strcpy(output, "joe");
     1466            } else {
     1467                strcpy(output, "vi");
     1468            }
     1469        }
     1470    }
     1471    mr_free(tmp);
     1472
     1473    tmp = find_home_of_exe(output);
     1474    if (!tmp) {
    14541475        log_msg(2, " (find_my_editor) --- warning - %s not found", output);
    14551476    }
     1477    mr_free(tmp);
    14561478    return (output);
    14571479}
Note: See TracChangeset for help on using the changeset viewer.