Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Quant-X Alpha Linux Support <stefan@sime.com>
To: syen5@npac.syr.edu
Cc: axp-list@redhat.com, joeyen@alpha.nmrlab.hscsyr.edu
Subject: Re: stat() broken under RH 5.0??
Date: Tue, 2 Jun 1998 02:37:30 +0200	[thread overview]
Message-ID: <199806020037.CAA01848@stefan.sime.com> (raw)
In-Reply-To: <Pine.SOL.3.96.980601182010.13382A-100000@tarkovsky.npac.syr.edu> (message from -= S J Y =- on Mon, 1 Jun 1998 18:22:22 -0400 (EDT))

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


       reply	other threads:[~1998-06-02  0:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.SOL.3.96.980601182010.13382A-100000@tarkovsky.npac.syr.edu>
1998-06-02  0:37 ` Quant-X Alpha Linux Support [this message]
1998-06-01 15:52 stat() broken under RH 5.0?? Mike
1998-06-01 21:45 ` Quant-X Alpha Linux Support
1998-06-02 13:20   ` Bill Roman
1998-06-02 15:07     ` Michal Jaegermann
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox