delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/03/18/21:53:51

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Thu, 18 Mar 2004 21:53:04 -0500 (EST)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: scyudits AT MIT DOT EDU
cc: cygwin AT cygwin DOT com
Subject: Re: seg fault on file write in cygwin, please help!!!
In-Reply-To: <1079660146.405a4e72c44f0@webmail.mit.edu>
Message-ID: <Pine.GSO.4.56.0403182145220.24444@slinky.cs.nyu.edu>
References: <1079660146 DOT 405a4e72c44f0 AT webmail DOT mit DOT edu>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.39

On Thu, 18 Mar 2004 scyudits AT MIT DOT EDU wrote:

> Hi,
>
> I am getting the following seg fault at the point in my C++ code where
> data gets written to a file.
>
> First, here is the code that is the source of the problem (should be
> correct):
>
> FILE *outfile = fopen("/home/Sophia/ns-allinone-2.27/ns-2.27/myfile.tcl", "w");
> fprintf(outfile, "%s", output);
>
> ...where output is a regular string (character array).
>
> Here is the backtrace from the seg fault, on running this code:
>
> (gdb) run
> Starting program: /home/Sophia/ns-allinone-2.27/ns-2.27/a.exe
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x610cfaa9 in wmemset () from /usr/bin/cygwin1.dll
> (gdb) backtrace
> [useless backtrace snipped]
>
> What's going on, and how do I fix this?
>
> Thanks,
> Sophia

Sophia,

First, please review the Cygwin problem reporting guidelines at
<http://cygwin.com/problems.html>, particularly the bit about attaching
(as an uncompressed text attachment) the output of "cygcheck -svr".

Second, please provide a simple (but complete) testcase program that
reproduces the problem on your machine, along with the exact compilation
instructions (preferably as a Makefile).  Make the testcase as small as
possible (e.g., output can be a constant string).

Third, please answer some questions about the context:
Does the crash happen with any filename?  Does the file exist?  If not, is
it created? Do all the intermediate directories exist?  What are the
permissions on the file and on the containing directory (both the "ls -l"
and the "getfacl" would be useful).

Once we have the information that would allow us to try to reproduce the
problem (and eliminate the obvious mistakes), we can start diagnosing what
can be wrong.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019