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/common/libmondo-devices.c

    r2330 r2331  
    509509    /*@ buffers ************************ */
    510510    char *tmp = NULL;
     511    char *tmp1 = NULL;
    511512    char *cdr_exe = NULL;
    512513    char *command = NULL;
     
    523524    }
    524525    run_program_and_log_output("insmod ide-scsi", -1);
    525     if (find_home_of_exe("cdrecord")) {
     526    tmp = find_home_of_exe("cdrecord");
     527    if (tmp) {
    526528        mr_asprintf(cdr_exe, "cdrecord");
    527529    } else {
    528530        mr_asprintf(cdr_exe, "dvdrecord");
    529531    }
    530     if (find_home_of_exe(cdr_exe)) {
     532    mr_free(tmp);
     533
     534    tmp1 = find_home_of_exe(cdr_exe);
     535    if (tmp1) {
    531536        mr_asprintf(command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep CD | cut -d' ' -f2 | head -n1", cdr_exe);
    532537        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    533538        mr_free(command);
    534539    }
     540    mr_free(tmp1);
     541
    535542    if ((tmp == NULL) || (strlen(tmp) < 2)) {
    536543        mr_free(tmp);
     
    603610    make_hole_for_dir(mountpoint);
    604611
    605     if (find_home_of_exe("cdrecord")) {
     612    tmp = find_home_of_exe("cdrecord");
     613    if (tmp) {
    606614        mr_asprintf(cdr_exe, "cdrecord");
    607615    } else {
    608616        mr_asprintf(cdr_exe, "dvdrecord");
    609617    }
    610 
    611     if (!find_home_of_exe(cdr_exe)) {
     618    mr_free(tmp);
     619
     620    tmp = find_home_of_exe(cdr_exe);
     621    if (!tmp) {
    612622        mr_asprintf(output, "/dev/cdrom");
    613623        log_msg(4, "Can't find cdrecord; assuming %s", output);
     
    616626            log_msg(4, "That didn't work. Sorry.");
    617627            mr_free(output);
    618             return(output);
    619         } else {
    620             return(output);
    621         }
    622     }
     628        }
     629        mr_free(tmp);
     630        return(output);
     631    }
     632    mr_free(tmp);
    623633
    624634    mr_asprintf(command, "%s -scanbus 2> /dev/null", cdr_exe);
     
    9921002        retval = 0;
    9931003    } else {
    994         mr_getline(&good_formats, pin);
     1004        mr_getline(good_formats, pin);
    9951005        if (pclose(pin)) {
    9961006            log_OS_error("Cannot pclose good formats");
     
    23442354        if (does_string_exist_in_boot_block(current_drive, "GRUB")) {
    23452355            count_grubs++;
     2356            /* BERLIOS : removed as I don't think it's mandatory here
    23462357            mr_free(which_device);
    23472358            mr_asprintf(which_device, "%s", current_drive);
     2359            */
    23482360            break;
    23492361        }
    23502362        if (does_string_exist_in_boot_block(current_drive, "LILO")) {
    23512363            count_lilos++;
     2364            /* BERLIOS : removed as I don't think it's mandatory here
    23522365            mr_free(which_device);
    23532366            mr_asprintf(which_device, "%s", current_drive);
     2367            */
    23542368            break;
    23552369        }
     
    23882402            if (does_string_exist_in_boot_block(current_drive, "GRUB")) {
    23892403                count_grubs++;
     2404                /* BERLIOS : removed as I don't think it's mandatory here
    23902405                mr_free(which_device);
    23912406                mr_asprintf(which_device, "%s", current_drive);
     2407                */
    23922408                break;
    23932409            }
    23942410            if (does_string_exist_in_boot_block(current_drive, "LILO")) {
    23952411                count_lilos++;
     2412                /* BERLIOS : removed as I don't think it's mandatory here
    23962413                mr_free(which_device);
    23972414                mr_asprintf(which_device, "%s", current_drive);
     2415                */
    23982416                break;
    23992417            }
Note: See TracChangeset for help on using the changeset viewer.