From owner-freebsd-questions Tue Oct 6 11:38:54 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA14122 for freebsd-questions-outgoing; Tue, 6 Oct 1998 11:38:54 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from coventry.ac.uk (mercury.coventry.ac.uk [193.61.107.16]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id LAA14084 for ; Tue, 6 Oct 1998 11:38:33 -0700 (PDT) (envelope-from justin@mascarpone.coventry.ac.uk) Received: from mascarpone.coventry.ac.uk (mascarpone.coventry.ac.uk [194.66.38.77]) by coventry.ac.uk (8.8.7/8.6.11) with SMTP id TAA11727 for <@mercury.coventry.ac.uk:questions@freebsd.org>; Tue, 6 Oct 1998 19:38:17 +0100 (BST) Received: (from justin@localhost) by mascarpone.coventry.ac.uk (950413.SGI.8.6.12/950213.SGI.AUTOCF) id TAA24511; Tue, 6 Oct 1998 19:37:46 +0100 Message-Id: <199810061837.TAA24511@mascarpone.coventry.ac.uk> Date: Tue, 6 Oct 98 19:37 +0100 From: Justin Murdock Subject: Help! FreeBSD 2.2.7 error?; fstat/stat To: questions@FreeBSD.ORG MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Af v1.98.4 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Perhaps I'm missing something, but on my (reasonably) freshly installed 2.2.7 (CD set) box #include #include #include #include main (int argc, char **argv ) { int myfd; struct stat mysb; struct stat myfdsb; if (argc!=2) { printf ("usage: %s ", argv[0]); exit (EINVAL); } stat(argv[1], &mysb); myfd=open(argv[1], O_RDONLY); fstat(myfd, &myfdsb); printf("%s: %d, %d\n", argv[1], mysb.st_size, myfdsb.st_size); } produces a binary that does this: % ./a.out /usr/home/jlocal/a.out /usr/home/jlocal/a.out: 8808, 0 My expectaton would be for both numbers to be 8808 What am I doing wrong? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message