Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Feb 1998 04:12:05 +0700 (ICT)
From:      Sunthiti Patchararungruang <stt@TCP>
To:        hackers@FreeBSD.ORG
Subject:   Re: Signal 11 problem 
Message-ID:  <Pine.BSF.3.96.980223040539.19496C-100000@pluto.cpe.ku.ac.th>
In-Reply-To: <199802221942.LAA08014@dingo.cdrom.com>

next in thread | previous in thread | raw e-mail | index | archive | help


On Sun, 22 Feb 1998, Mike Smith wrote:

> > Dear Everybody,
> 
> 
> > 	I have written a C program which has a function that need 10
> > arguments. I cannot run this program because the signal-11 occured when I
> > call this function. However, when I reduce the number of arguments the
> > program can be executed without error. I tried to change eliminated
> > arguments to check which one causes the error but the program still
> > completely operate. Therefore, I conclude that the problem come from stack
> > management in FreeBSD. What should I do?
> 
> Debug your program.  Oddly enough, there are lots of people using 
> FreeBSD, and innumerable functions taking more than 10 arguments.
> 
> Your conclusion is bogus; did you really believe that in all these 
> years, nobody had ever tried this before?
> 
> You should start by applying the debugger (gdb) to your program and the 
> core file produced when it crashes.  If you build your program with the 
> '-g' flag you will be able to determine the source line on which the 
> fault occurs.  (This may not be the location of the bug itself, of 
> course.)
> 


	Sorry about my useless example. Here is the real problem. I cut it
from wu-ftpd 2.4. All variables are proved to be correct. I use
FreeBSD2.2.5.

        sprintf(msg, "%.24s %d %s %d %s %c %s %c %c %s ftp %d %s\n",
                ctime(&curtime),
                xfertime,
                remotehost,
                byte_count,
                namebuf,
                (type == TYPE_A) ? 'a' : 'b',
                opt_string(options),
                'o',
                anonymous ? 'a' : 'r',
                anonymous ? guestpw : pw->pw_name,
                authenticated,
                authenticated ? authuser : "*"
	);

	However, if I rewrite it as the following, the program now
operates correctly.

        sprintf(tmsg, "%.24s %d %s %d\n",
                ctime(&curtime),
                xfertime,
                remotehost,
                byte_count
            );
	strcat (tmsg, namebuf);
        sprintf(msg, "%s %c %s %c %c %s ftp %d %s\n",
		tmsg,
                (type == TYPE_A) ? 'a' : 'b',
                opt_string(options),
                'o',
                anonymous ? 'a' : 'r',
                anonymous ? guestpw : pw->pw_name,
                authenticated,
                authenticated ? authuser : "*"
            );


Best Regards,
Sunthiti Patchararungruang



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.980223040539.19496C-100000>