Hello,

recently while debugging a problem in wwwoffle-2.5b I realized,
that stat(2) behaves at least extremely strange on 3.3-STABLE:

This small example...

  #include <stdio.h>
  #include <sys/types.h>
  #include <sys/stat.h>

  int main(int argc, char *argv[]) {

    char        *fname = argv[0];
    struct stat  sb;
    int          res = stat(argv[0], &sb);

    printf("filename   : %s\n" \
           "st_size    : %d\n" \
           "st_blocks  : %d\n" \
           "st_blksize : %d\n",
           fname, sb.st_size, sb.st_blocks, sb.st_blksize);

    return res;

  }

would emerge this when run:

  filename   : ./a.out
  st_size    : 3342
  st_blocks  : 0
  st_blksize : 8

Any idea why st_blocks is always zero? This can't be correct.
st_blksize seems to be the number of blocks allocated for
filename, although assuming a blocksize of 512 the object
would fit into 7 blocks. Maybe that's the result of the
underlying FFS's fsize (1024).

  Björn

-- 
-----BEGIN GEEK CODE BLOCK-----
GCS d--(+) s++: a- C+++(-) UB++++OSI++++$ P+++(-) L---(++) !E W- N+ o>+
K- !w !O !M !V  PS++  PE-  PGP++  t+++  !5 X++ tv- b+++ D++ G e+ h-- y+ 
------END GEEK CODE BLOCK------


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to