Fix disk space checking when zero blocks / inodes are available (rhbz#308171)
authorPanu Matilainen <pmatilai@redhat.com>
Thu, 27 Sep 2007 07:37:19 +0000 (10:37 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Thu, 27 Sep 2007 07:37:19 +0000 (10:37 +0300)
When installing a rpm that requires space on a filesystem with 0 blocks free,
rpm will not detect that there is insufficient space on the filesystem.

Patch from Patrick Bergamin

lib/rpmts.c

index c228279..bb5dc9e 100644 (file)
@@ -1245,14 +1245,14 @@ void rpmtsCheckDSIProblems(const rpmts ts, const rpmte te)
     ps = rpmtsProblems(ts);
     for (i = 0; i < ts->filesystemCount; i++, dsi++) {
 
-       if (dsi->bavail > 0 && adj_fs_blocks(dsi->bneeded) > dsi->bavail) {
+       if (dsi->bavail >= 0 && adj_fs_blocks(dsi->bneeded) > dsi->bavail) {
            rpmpsAppend(ps, RPMPROB_DISKSPACE,
                        rpmteNEVR(te), rpmteKey(te),
                        ts->filesystems[i], NULL, NULL,
           (adj_fs_blocks(dsi->bneeded) - dsi->bavail) * dsi->bsize);
        }
 
-       if (dsi->iavail > 0 && adj_fs_blocks(dsi->ineeded) > dsi->iavail) {
+       if (dsi->iavail >= 0 && adj_fs_blocks(dsi->ineeded) > dsi->iavail) {
            rpmpsAppend(ps, RPMPROB_DISKNODES,
                        rpmteNEVR(te), rpmteKey(te),
                        ts->filesystems[i], NULL, NULL,