Ignore:
Timestamp:
Aug 18, 2009, 3:25:29 PM (11 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/common/libmondo-tools.c

    r2329 r2331  
    418418    char *tmp = NULL;
    419419    char *p = NULL;
    420     char call_before_iso_user = NULL;
     420    char *call_before_iso_user = NULL;
    421421    char *iso_dev = NULL;
    422422    char *iso_mnt = NULL;
     
    494494
    495495    if (bkpinfo->backup_media_type == dvd) {
    496         if (find_home_of_exe("growisofs")) {
     496        tmp = find_home_of_exe("growisofs");
     497        if (tmp) {
    497498            strcpy(cdr_exe, "growisofs");
    498499        }                       // unlikely to be used
    499500        else {
     501            mr_free(tmp);
    500502            fatal_error("Please install growisofs.");
    501503        }
     504        mr_free(tmp);
     505
    502506        if (bkpinfo->nonbootable_backup) {
    503507            mr_asprintf(mondo_mkisofs_sz, MONDO_GROWISOFS_NONBOOT);
     
    554558            mr_asprintf(extra_cdrom_params, "blank=fast ");
    555559        }
    556         if (find_home_of_exe("cdrecord")) {
     560        tmp = find_home_of_exe("cdrecord");
     561        if (tmp) {
    557562            strcpy(cdr_exe, "cdrecord");
    558         } else if (find_home_of_exe("dvdrecord")) {
    559             strcpy(cdr_exe, "dvdrecord");
    560563        } else {
    561             fatal_error("Please install either cdrecord or dvdrecord.");
    562         }
     564            mr_free(tmp);
     565            tmp = find_home_of_exe("dvdrecord");
     566            if (tmp) {
     567                strcpy(cdr_exe, "dvdrecord");
     568            } else {
     569                mr_free(tmp);
     570                fatal_error("Please install either cdrecord or dvdrecord.");
     571            }
     572        }
     573        mr_free(tmp);
     574
    563575        if (bkpinfo->nonbootable_backup) {
    564576            mr_asprintf(mondo_mkisofs_sz, MONDO_MKISOFS_NONBOOT);
     
    10001012    }
    10011013
    1002     if (!find_home_of_exe("cmp")) {
    1003         if (!find_home_of_exe("true")) {
    1004             whine_if_not_found("cmp");
     1014    tmp = find_home_of_exe("cmp");
     1015    if (!tmp) {
     1016        mr_free(tmp);
     1017        tmp = find_home_of_exe("true");
     1018        if (!tmp) {
     1019            retval += whine_if_not_found("cmp");
    10051020        } else {
    1006             log_to_screen
    1007                 ("Your system lacks the 'cmp' binary. I'll create a dummy cmp for you.");
    1008             if (run_program_and_log_output
    1009                 ("cp -f `which true` /usr/bin/cmp", 0)) {
     1021            log_to_screen("Your system lacks the 'cmp' binary. I'll create a dummy cmp for you.");
     1022            if (run_program_and_log_output("cp -f `which true` /usr/bin/cmp", 0)) {
     1023                mr_free(tmp);
    10101024                fatal_error("Failed to create dummy 'cmp' file.");
    10111025            }
    10121026        }
    10131027    }
    1014     run_program_and_log_output
    1015         ("umount `mount | grep cdr | cut -d' ' -f3 | tr '\n' ' '`", 5);
     1028    mr_free(tmp);
     1029
     1030    run_program_and_log_output("umount `mount | grep cdr | cut -d' ' -f3 | tr '\n' ' '`", 5);
    10161031    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("mount | grep -E \"cdr(om|w)\""));
    10171032    if (strcmp("", tmp)) {
Note: See TracChangeset for help on using the changeset viewer.