Ignore:
Timestamp:
Sep 23, 2006, 10:57:13 AM (18 years ago)
Author:
andree
Message:

Evaluate errno after popen in space_occupied_by_cd() and in case of an
error create a log entry and return 0 as size.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mondo/mondo/common/libmondo-files.c

    r802 r816  
    967967
    968968    sprintf(command, "du -sk %s", mountpt);
     969    errno = 0;
    969970    fin = popen(command, "r");
    970     (void) fgets(tmp, MAX_STR_LEN, fin);
    971     paranoid_pclose(fin);
    972     p = strchr(tmp, '\t');
    973     if (p) {
    974         *p = '\0';
    975     }
    976     for (p = tmp, llres = 0; *p != '\0'; p++) {
    977         llres *= 10;
    978         llres += (int) (*p - '0');
    979     }
     971    if (errno) {
     972      log_it("popen() FAILED: command=%s, mountpt=%s, fin=%d, errno=%d, strerror=%s", command, mountpt, fin, errno, strerror(errno));
     973      llres = 0;
     974    } else {
     975      (void) fgets(tmp, MAX_STR_LEN, fin);
     976      paranoid_pclose(fin);
     977      p = strchr(tmp, '\t');
     978      if (p) {
     979        *p = '\0';
     980      }
     981      for (p = tmp, llres = 0; *p != '\0'; p++) {
     982        llres *= 10;
     983        llres += (int) (*p - '0');
     984      }
     985    }
     986
    980987    return (llres);
    981988}
Note: See TracChangeset for help on using the changeset viewer.