[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PL48: statfs, PatchLev.h



 Hi again!

1. I think one of the two PatchLev.h should be removed! The one in lib/ set 
   PatchLevel to 47 and the one in include/ to 48!?
   I meen PatchLev.h should only be in the lib sources and do not installed 
   with the other include files.

2. Have I found a bug in statfs()?
   If I try to get infos about "U:\j" (ZIP drive without a medium), I got 
   wrong values in the struct statfs.
   Take a look at statfs():
   
     ...
     r = stat(path, &statbuf);
     if (r == -1)
        return -1;

     ...
     Dfree(&free, statbuf.st_dev + 1);

   The first stat() works correct because U:\j is valid drive/path. But then 
   the Dfree() returns -1 because no informations about the medium are 
   available. In this case I think the return value of Dfree() had to be 
   checked. My propose:
   
   --- /i/mintlib/lib/statfs.c Thu Aug 28 20:59:04 1997
   +++ statfs.c    Wed May 20 18:54:04 1998
   @@ -76,14 +76,24 @@ if (getcwd(oldpath, PATH_MAX) != NULL)
          {
            chdir(path);
   -        Dfree(&free, statbuf.st_dev + 1);
   +        r = Dfree(&free, statbuf.st_dev + 1);
            chdir(oldpath);
          }
          else
   -        Dfree(&free, statbuf.st_dev + 1);
   +        r = Dfree(&free, statbuf.st_dev + 1);
        }
        else
   -      Dfree(&free, statbuf.st_dev + 1);
   +      r = Dfree(&free, statbuf.st_dev + 1);
   +
   +    /* 
   +     * Drive exists but Dfree() failed
   +     * (e.g. no medium in removable drive) 
   +    */
   +    if (r < 0)
   +    {
   +       errno = -r;
   +       return -1;
   +    }
    
        buf->f_type = 0;
        buf->f_bsize = free.b_secsiz * free.b_clsiz;
     
   Any comments?


 Chris.