Ignore:
Timestamp:
May 14, 2009, 3:10:51 AM (12 years ago)
Author:
Bruno Cornec
Message:
  • Cleanups
  • Fix test on return value for open (-1 is the right value to test not 0)
  • Improve asprintf usage for mountlist
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mondo/src/common/libmondo-mountlist.c

    r2204 r2205  
    658658        asprintf(&drive, "%s", mountlist->el[lino].device);
    659659        if (!strncmp(drive, RAID_DEVICE_STUB, strlen(RAID_DEVICE_STUB))) {
    660             log_msg(8, "Not putting %s in list of drives: it's a virtual drive",
    661                     drive);
     660            log_msg(8, "Not putting %s in list of drives: it's a virtual drive", drive);
     661            paranoid_free(drive);
    662662            continue;
    663663        }
     
    665665        size = mountlist->el[lino].size;
    666666        if (size == 0) {
    667             log_msg(8,
    668                     "Not putting %s in list of drives: it has zero size (maybe an LVM volume)",
    669                     drive);
     667            log_msg(8, "Not putting %s in list of drives: it has zero size (maybe an LVM volume)", drive);
     668            paranoid_free(drive);
    670669            continue;
    671670        }
    672671
    673         log_msg(8, "Putting %s with size %lli in list of drives",
    674                 drive, size);
     672        log_msg(8, "Putting %s with size %lli in list of drives", drive, size);
    675673
    676674        (void) truncate_to_drive_name(drive);
    677675        for (j = 0;
    678676             j < noof_drives
    679              && strcmp(drivelist->el[j].device, drive) != 0; j++)
     677             && strcmp(drivelist->el[j].device, drive) != 0; j++) {
     678            paranoid_free(drive);
    680679            continue;
     680        }
    681681        if (j == noof_drives) {
    682682            strcpy(drivelist->el[noof_drives++].device, drive);
    683683        }
     684        paranoid_free(drive);
    684685    }
    685686    drivelist->entries = noof_drives;
     
    816817        if (res < 5) {
    817818            /* no label found */
    818             asprintf(&(mountlist->el[items].label), "%s", "");
     819            asprintf(&tmp, "%s", "");
     820            mountlist->el[items].label = tmp;
    819821        }
    820822#elif __FreeBSD__
     
    824826               mountlist->el[items].mountpoint,
    825827               mountlist->el[items].format, siz);
    826         asprintf(&(mountlist->el[items].label), "%s", "");
     828        asprintf(&tmp, "%s", "");
     829        mountlist->el[items].label = tmp;
    827830#endif
    828831
Note: See TracChangeset for help on using the changeset viewer.