* Cameron Simpson ([EMAIL PROTECTED]) wrote:
> On Mon, Feb 28, 2000 at 04:26:56PM +0000, Tom Gilbert wrote:
> | * David Filion ([EMAIL PROTECTED]) wrote:
> | > I'm trying to compile a C program that I wrote on a Sun system
> | > but it won't work. The code compiles and runs fine on the
> | > Sun server. However, [...]
> |
> | Well, this isn't really the forum for it.
>
> Well... Linux/Solaris differences _can_ be addressed here.
>
> [...]
> | > Program received signal SIGSEGV Segmentation fault.
> | > 0x40075027 in strlen (str = 0x0 ) at ../sysdeps/i386/strlen.c:27
> | > ../sysdeps/i386/strlen.c:27 No such file or directory.
> | You are calling strlen on NULL.
> [...]
> | > #0 strcpy (dest=0xbffff9e4 "É", src= 0x0) at ../sysdeps/generic/strcpy.c:37
> | > ../sysdeps/generic/strcpy.c:37: No such file or directory
> | You are copying a NULL string into what looks like garbage (unmalloced
> | memory or a char buffer which is uninitialised).
> | > The code is ANSI C compliant and contains no fancy tricks and nothing
> | > system dependant.
>
> And calling strcpy and strlen on NULL is _not_ ANSI compliant.
> Thought this worth mentioning.
>
> | > Anyone have any ideas?
>
> Show us the code. Better still, first winnow it down to as small an example
> as you can and still have it fail. And then show us the code.
Seen it now. The offending line was:
#define PATH_VARIABLE_NAME "TTSDATA"
[...]
strcpy(task_filename, getenv(PATH_VARIABLE_NAME));
On his Sun system, the environment variable TTSDATA is defined, on his
linux box, it is not :)
That's where it segfaults. getenv returns NULL and the first strlen()
in strcpy() dumps core.
So it's not a Sun/Linux thing, it's an environment thing :)
Tom.
--
.-------------------------------------------------------.
.^. | Tom Gilbert, England | [EMAIL PROTECTED] |
/V\ |----------------------| www.tomgilbert.freeserve.co.uk |
// \\ | Sites I recommend: `--------------------------------|
/( )\ | www.freshmeat.net www.enlightenment.org slashdot.org |
^^-^^ `-------------------------------------------------------'
--
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.