fprintf crases

Hi All,

I am getting this issue ,

when I am running my test.so under the following OS configuration,uname -a output as the below

SunOS hello_test 5.9 Generic_118558-35 sun4u sparc SUNW,Sun-Blade-100,

I get Crash occurred in function fprintf from module /usr/lib/libc.so.1.

But the same shared object if I run in a machine with following configuration I

SunOS bdcnetra03 5.9 Generic_117171-17 sun4u sparc SUNW,UltraSPARC-IIi-cEngine don't get any issue.

Any suggestions or help would be appreciated. Is there any issue accros OS version as they mismatch (one Generic_118558-35 and other as Generic_117171-17 ) although their release is same (5.9).

Thanks and regards

-A

[733 byte] By [ujara] at [2007-11-27 6:37:30]
# 1

Hello.

a) Are you sure all arguments are correct?

b) Are you sure the FILE* argument is correct and the file is OK?

c) How long is the string you want to print (number of characters written to the file)?

d) If you use "%s" are you sure all the strings are NUL-terminated?

Martin

Martin_Rosenaua at 2007-7-12 18:05:56 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 2

Hi,

I am wondering if those were the issue then it should be consistent across all OS versions isn't it?Correct me if I am wrong.I get this issue only when the OS version is Generic_118558-35 and release 5.9 else I don't get like for example Generic_117171-17 and release 5.9 it works fine.

Thanks

-A

ujara at 2007-7-12 18:05:56 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 3

> Hi,

> I am wondering if those were the issue then it should

> be consistent across all OS versions isn't it?

Hello

Your problem is not the OS kernel it is one of the libraries - I think it is a different version of libc.so.1 - or it is a difference on the two machines having nothing to do with the OS version.

The first problem could be very simple: On one machine fopen() succeeds while on the other machine fopen() fails. So the FILE* argument is NULL in one case.

Another problem can be caused by other operations that are not correct:

f=fopen(filename,"w");

strcpy(uninitialized_pointer_variable,"xyz");

fprintf(f,"Hello.\n");

The actual value of "uninitialized_pointer_variable" depends on many factors. It may be "&f" and so the contents of f is destroyed.

Functions with a variable number of arguments often depend on the previous command if the arguments are wrong:

f=fopen(filename,"w");

anyFunction();

fprintf(f,"%s\n" /* a string is missing here */);

Now it is depending on the actual implementation of "anyFunction" (If the "fprintf" directly follows the "fopen" anyFunction=fopen) - this means on the version of libc.so.1 - if the program is running or not.

Martin

Martin_Rosenaua at 2007-7-12 18:05:56 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 4

Hi,

Thanks for the reply and update.

Can you tell me as how do I find the version of libc.so.1 on a particular machine?

And what other differences should I look in among the different machines to figure out the issue.Also suggest me some workaround.

Looking forward for your response.

Thanks

-A

ujara at 2007-7-12 18:05:56 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...