From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 23745 invoked from network); 2 Jun 1998 00:39:07 -0000 Received: from stefan.sime.com (193.228.80.247) by mail2.redhat.com with SMTP; 2 Jun 1998 00:39:07 -0000 Received: (from stefan@localhost) by stefan.sime.com (8.8.7/8.8.7) id CAA01848; Tue, 2 Jun 1998 02:37:30 +0200 Date: Tue, 2 Jun 1998 02:37:30 +0200 Message-Id: <199806020037.CAA01848@stefan.sime.com> From: Quant-X Alpha Linux Support To: syen5@npac.syr.edu CC: axp-list@redhat.com, joeyen@alpha.nmrlab.hscsyr.edu In-reply-to: (message from -= S J Y =- on Mon, 1 Jun 1998 18:22:22 -0400 (EDT)) Subject: Re: stat() broken under RH 5.0?? MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: Quant-X Alpha Linux Support Reply-To: Quant-X Alpha Linux Support Organization: Quant-X Service & Consulting Ges.m.b.H. X-Mailer: GNU Emacs 20.2.1 C-x m (X11 ; I; Linux 2.0.32 i586) References: Hi Stefan ! > > main() > > { > > struct stat *buf; > > stat("teststat.c",buf); > > printf("%d\n",buf->st_mode); > > } > Doh! Makes sense. It's interesting that it compiled and ran > under SunOS though. I wonder if its implementation of stat automatically > mallocs the argument. Thanks for the suggestion. Sorry, but ouups [again]. ;-] Even good old SunOS can't automatically allocate the struct. (ok, it theoretically can, but if you call stat(file, NULL); there is no way to get the allocated "struct stat" pointer back !) Trust me, it only works if you have a cool random pointer, this is simply a platform-independent bug that gernerates platform/compiler-dependent results... Be careful. -- Quant-X Service & Ph: (+43) 4212 6004-0 Consulting Ges.m.b.H. Fax: (+43) 4212 600420 http://www.quant-x.com Email: support@quant-x.com