[Bf-committers] fix for segmentation fault on open under linux

Hans Lambermont bf-committers@blender.org
Mon, 5 Apr 2004 19:05:18 +0200


Stephen Swaney wrote:

> Rick Kimball wrote:
> > diff -n -u -r1.11 storage.c
> > cvs server: conflicting specifications of output style
> > --- source/blender/blenlib/intern/storage.c     30 Mar 2004 14:41:08 -0000      1.11
> > +++ source/blender/blenlib/intern/storage.c     4 Apr 2004 17:46:42 -0000
> > @@ -356,7 +356,12 @@
> >                  strcpy(files[num].owner,"user");
> >   #else
> >                  pwuser = getpwuid(files[num].s.st_uid);
> > -               strcpy(files[num].owner, pwuser->pw_name);
> > +               if ( pwuser ) {
> > +                 strcpy(files[num].owner, pwuser->pw_name);
> > +               }
> > +               else {
> > +                 sprintf(files[num].owner, "%d", files[num].s.st_uid);
> > +               }
> >   #endif
> > 
> >                  tm= localtime(&files[num].s.st_mtime);
> > _______________________________________________
> 
> I was thinking of checking this into CVS, but it
> occurred to me that other non-linux unices might define
> the struct with st_uid differently.  Perhaps
> one of the other platform users could check this?

Well, on FreeBSD sys/stat.h does have a st_uid. Besides, looking at your
proposed patch, I see files[num].s.st_uid already being used just before
the line you removed.

-- Hans