Changeset 839 in MondoRescue for trunk/mondo/src/common/libmondo-files.c


Ignore:
Timestamp:
Sep 26, 2006, 9:47:32 AM (18 years ago)
Author:
Bruno Cornec
Message:

merge -r814:838 $SVN_M/branches/stable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mondo/src/common/libmondo-files.c

    r808 r839  
    772772
    773773    asprintf(&command, "du -sk %s", mountpt);
     774    errno = 0;
    774775    fin = popen(command, "r");
    775     paranoid_free(command);
    776 
    777     (void) getline(&tmp, &n, fin);
    778     paranoid_pclose(fin);
    779     p = strchr(tmp, '\t');
    780     if (p) {
    781         *p = '\0';
    782     }
    783     for (p = tmp, llres = 0; *p != '\0'; p++) {
    784         llres *= 10;
    785         llres += (int) (*p - '0');
    786     }
     776    if (errno) {
     777      log_it("popen() FAILED: command=%s, mountpt=%s, fin=%d, errno=%d, strerror=%s", command, mountpt, fin, errno, strerror(errno));
     778      llres = 0;
     779    } else {
     780        (void) getline(&tmp, &n, fin);
     781        paranoid_pclose(fin);
     782        p = strchr(tmp, '\t');
     783        if (p) {
     784            *p = '\0';
     785        }
     786        for (p = tmp, llres = 0; *p != '\0'; p++) {
     787            llres *= 10;
     788            llres += (int) (*p - '0');
     789        }
     790    }
     791
     792    paranoid_free(command);
    787793    paranoid_free(tmp);
    788794    return (llres);
Note: See TracChangeset for help on using the changeset viewer.