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

Stephen Swaney bf-committers@blender.org
Mon, 05 Apr 2004 10:08:06 -0500


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?

As a member of the rogue python team, I would not
want to be the one to break the Irix build!  ( Or even
Solaris. )

-- 
Stephen Swaney			
sswaney@swbell.net