Ignore:
Timestamp:
Nov 10, 2012, 5:05:37 AM (11 years ago)
Author:
Bruno Cornec
Message:

r5035@localhost: bruno | 2012-11-09 03:17:01 +0100

  • Fix a compilation error and most compilation warnings
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/mondo/src/common/libmondo-devices.c

    r3052 r3060  
    348348    char *searchstr = NULL;
    349349    char *tmp;
     350    char *p;
    350351
    351352    /*@ ints ******************************************************* */
     
    383384    (void) build_partition_name(searchstr, drive, partno);
    384385    strcat(searchstr, " ");
    385     for (res = 0; !res && fgets(incoming, MAX_STR_LEN - 1, fin);) {
     386    for (res = 0; !res && (p = fgets(incoming, MAX_STR_LEN - 1, fin));) {
    386387        if (strstr(incoming, searchstr)) {
    387388            res = 1;
     
    677678        return (1);
    678679    }
    679     for ((void)fgets(tmp, MAX_STR_LEN, fin); !feof(fin);
    680          (void)fgets(tmp, MAX_STR_LEN, fin)) {
     680    for (tmp1 = fgets(tmp, MAX_STR_LEN, fin); !feof(fin) && (tmp1 != NULL);
     681         tmp1 = fgets(tmp, MAX_STR_LEN, fin)) {
    681682        p = strchr(tmp, '\'');
    682683        if (p) {
     
    711712            log_msg(4, "Cannot run 2nd command - non-fatal, fortunately");
    712713        } else {
    713             for ((void)fgets(tmp, MAX_STR_LEN, fin); !feof(fin);
    714                  (void)fgets(tmp, MAX_STR_LEN, fin)) {
     714            for (tmp1 = fgets(tmp, MAX_STR_LEN, fin); !feof(fin) && (tmp1 != NULL);
     715                 tmp1 = fgets(tmp, MAX_STR_LEN, fin)) {
    715716                log_msg(5, "--> '%s'", tmp);
    716717                if (tmp[0] != ' ' && tmp[1] != ' ') {
     
    915916    }
    916917
    917     sprintf(tmp, "%s", call_program_and_get_last_line_of_output
    918             ("dvdrecord -scanbus 2> /dev/null | grep \)\ \' | grep -n '' | grep -E '[D|C][V|D]' | cut -d':' -f1")
    919         );
     918    sprintf(tmp, "%s", call_program_and_get_last_line_of_output("dvdrecord -scanbus 2> /dev/null | grep -E '\)\ \'' | grep -n '' | grep -E '[D|C][V|D]' | cut -d':' -f1"));
    920919    log_msg(5, "tmp = '%s'", tmp);
    921920    if (!tmp[0])
     
    959958#if linux
    960959    unsigned long long s = 0;
    961     int fileid, cylinders = 0, cylindersleft = 0;
     960    int fileid, cylinders = 0;
    962961    int cylindersize = 0;
    963962    int gotgeo = 0;
     
    10081007            if (ioctl(fileid, HDIO_GETGEO, &hdgeo) != -1) {
    10091008                if (hdgeo.cylinders && hdgeo.heads && hdgeo.sectors) {
    1010                     cylindersleft = cylinders = hdgeo.cylinders;
    10111009                    cylindersize = hdgeo.heads * hdgeo.sectors / 2;
    10121010                    outvalA = cylindersize * cylinders / 1024;
     
    10561054    char *command;
    10571055    char *format_sz;
     1056    char *p;
    10581057
    10591058    FILE *pin;
     
    10811080    } else {
    10821081        strcpy(good_formats, " ");
    1083         (void) fgets(good_formats + 1, MAX_STR_LEN - 1, pin);
    1084         if (pclose(pin)) {
     1082        p = fgets(good_formats + 1, MAX_STR_LEN - 1, pin);
     1083        if (pclose(pin) && (p != NULL)) {
    10851084            log_OS_error("Cannot pclose good formats");
    10861085        }
     
    11531152        return(FALSE);
    11541153    }
    1155     for ((void)fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin);
    1156          (void)fgets(incoming, MAX_STR_LEN - 1, fin)) {
     1154    for (tmp = fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin) && (tmp != NULL);
     1155         tmp = fgets(incoming, MAX_STR_LEN - 1, fin)) {
    11571156        if (strstr(incoming, device_with_space) //> incoming
    11581157            || strstr(incoming, device_with_tab))   // > incoming)
     
    25252524        if (bkpinfo->disaster_recovery) {
    25262525            sprintf(command ,"umount %s/isodir 2> /dev/null", bkpinfo->tmpdir);
    2527             (void)system(command);
     2526            paranoid_system(command);
    25282527        }
    25292528        strcpy(tmp1, bkpinfo->netfs_proto);
     
    29812980    /* Before changing remove old ones if any */
    29822981    if (bkpinfo->scratchdir) {
    2983         chdir("/tmp");
     2982        if (chdir("/tmp")) {
     2983            // FIXME
     2984        }
    29842985        mr_asprintf(&tmp1, "rm -Rf %s", bkpinfo->scratchdir);
    29852986        paranoid_system(tmp1);
     
    31903191    char *list_drives_cmd = NULL;
    31913192    char *current_drive;
     3193    char *tmp;
    31923194
    31933195    /*@ pointers *************************************************** */
     
    32193221    mr_free(list_drives_cmd);
    32203222
    3221     for ((void)fgets(current_drive, MAX_STR_LEN, pdrives); !feof(pdrives);
    3222          (void)fgets(current_drive, MAX_STR_LEN, pdrives)) {
     3223    for (tmp = fgets(current_drive, MAX_STR_LEN, pdrives); !feof(pdrives) && (tmp != NULL);
     3224         tmp = fgets(current_drive, MAX_STR_LEN, pdrives)) {
    32233225        strip_spaces(current_drive);
    32243226        log_it("looking at drive %s's MBR", current_drive);
     
    32613263        mr_free(list_drives_cmd);
    32623264
    3263         for ((void)fgets(current_drive, MAX_STR_LEN, pdrives); !feof(pdrives);
    3264             (void)fgets(current_drive, MAX_STR_LEN, pdrives)) {
     3265        for (tmp = fgets(current_drive, MAX_STR_LEN, pdrives); !feof(pdrives) && (tmp != NULL);
     3266            tmp = fgets(current_drive, MAX_STR_LEN, pdrives)) {
    32653267            strip_spaces(current_drive);
    32663268            log_it("looking at partition %s's BR", current_drive);
Note: See TracChangeset for help on using the changeset viewer.