<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: C Src code giving CORE dump in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/c-src-code-giving-core-dump/m-p/5135469#M688686</link>
    <description>Thanks everyone...</description>
    <pubDate>Wed, 15 Oct 2008 04:55:47 GMT</pubDate>
    <dc:creator>LeoThe13th</dc:creator>
    <dc:date>2008-10-15T04:55:47Z</dc:date>
    <item>
      <title>C Src code giving CORE dump</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/c-src-code-giving-core-dump/m-p/5135460#M688677</link>
      <description>&lt;!--!*#--&gt;Hi,&lt;BR /&gt;I am migrating my applciation from 32bit to 64bit. AFter successful compilation executable is giving core dump. After using Debugging statement i found the point of failure.&lt;BR /&gt;&lt;BR /&gt;static char *PIDfilename;  &lt;BR /&gt;&lt;BR /&gt;PIDfilename = (char *) malloc(strlen("var/") + strlen(processName) + strlen(".pid") + 1);&lt;BR /&gt;&lt;BR /&gt;*PIDfilename = '\0';&lt;BR /&gt;&lt;BR /&gt; strcat(PIDfilename, "var/");&lt;BR /&gt;strcat(PIDfilename, processName);&lt;BR /&gt;strcat(PIDfilename, ".pid");&lt;BR /&gt;&lt;BR /&gt;EOC&lt;BR /&gt;&lt;BR /&gt;line where \0 is assign is giving core dump I have tried with NULL, strcpy..all statement is fiving core dump.&lt;BR /&gt;Can anyone suggest on this.&lt;BR /&gt;Thanks&lt;BR /&gt;Bhushan&lt;BR /&gt;</description>
      <pubDate>Tue, 14 Oct 2008 06:49:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/c-src-code-giving-core-dump/m-p/5135460#M688677</guid>
      <dc:creator>LeoThe13th</dc:creator>
      <dc:date>2008-10-14T06:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: C Src code giving CORE dump</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/c-src-code-giving-core-dump/m-p/5135461#M688678</link>
      <description>I assume this is a snippet of the actual code, with a lot of things omitted. It certainly isn't a standalone example that could be compiled on its own to demonstrate the problem.&lt;BR /&gt;&lt;BR /&gt;Things to check:&lt;BR /&gt;&lt;BR /&gt;- Is the "processName" variable properly initialized at the point malloc() is executed? &lt;BR /&gt;&lt;BR /&gt;- Did the malloc() operation complete successfully, or did it fail? &lt;BR /&gt;&lt;BR /&gt;(If it failed, the assignment is doomed to fail. The application should at least detect this and try to exit in a controlled manner, preferably after outputting a meaningful error message.)&lt;BR /&gt;&lt;BR /&gt;- Is there anything in between the malloc() operation and the assignment to "*PIDfilename" that might corrupt the value of the "PIDfilename" pointer? &lt;BR /&gt;&lt;BR /&gt;(In the code you have shown, there is nothing. But this code is obviously incomplete - have you snipped away something from between these lines?)&lt;BR /&gt;&lt;BR /&gt;MK</description>
      <pubDate>Tue, 14 Oct 2008 08:52:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/c-src-code-giving-core-dump/m-p/5135461#M688678</guid>
      <dc:creator>Matti_Kurkela</dc:creator>
      <dc:date>2008-10-14T08:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: C Src code giving CORE dump</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/c-src-code-giving-core-dump/m-p/5135462#M688679</link>
      <description>I have attached the code. This code when compiled with 32bit mode then it is successfully executed.&lt;BR /&gt;But when i compiled with 64bit then attached code is not working and giving core dump.&lt;BR /&gt;&lt;BR /&gt;This a complete code.</description>
      <pubDate>Tue, 14 Oct 2008 10:43:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/c-src-code-giving-core-dump/m-p/5135462#M688679</guid>
      <dc:creator>LeoThe13th</dc:creator>
      <dc:date>2008-10-14T10:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: C Src code giving CORE dump</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/c-src-code-giving-core-dump/m-p/5135463#M688680</link>
      <description>&lt;!--!*#--&gt;My HP-UX system is down right now, but on&lt;BR /&gt;VMS, you seem to be missing some crucial&lt;BR /&gt;header files.  For example:&lt;BR /&gt;&lt;BR /&gt;alp $ cc 313166.C_ORIG&lt;BR /&gt;&lt;BR /&gt;        PIDfilename = (char *) malloc(strlen("/EEH/var/") + strlen(processName)&lt;BR /&gt;+ strlen(".pid") + 1);&lt;BR /&gt;...............................^&lt;BR /&gt;%CC-I-IMPLICITFUNC, In this statement, the identifier "malloc" is implicitly declared as a function.&lt;BR /&gt;at line number 24 in file ALP$DKA0:[SMS.ITRC]313166.C_ORIG;1&lt;BR /&gt;[...]&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If your compiler thinks that malloc() is an&lt;BR /&gt;"int", then you might losing 32 bits worth of&lt;BR /&gt;pointer there.  &lt;STDLIB.H&gt; could help.&lt;BR /&gt;&lt;BR /&gt;How are you compiling this without getting a&lt;BR /&gt;bunch of warnings?&lt;/STDLIB.H&gt;</description>
      <pubDate>Tue, 14 Oct 2008 10:58:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/c-src-code-giving-core-dump/m-p/5135463#M688680</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2008-10-14T10:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: C Src code giving CORE dump</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/c-src-code-giving-core-dump/m-p/5135464#M688681</link>
      <description>if you do not include stdlib.h, then malloc() return a int (32 bits) and not a long or void *.&lt;BR /&gt;&lt;BR /&gt;So you malloc result is truncated.&lt;BR /&gt;you can also do&lt;BR /&gt;&lt;BR /&gt;extern void * malloc(int);&lt;BR /&gt;</description>
      <pubDate>Tue, 14 Oct 2008 11:35:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/c-src-code-giving-core-dump/m-p/5135464#M688681</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2008-10-14T11:35:27Z</dc:date>
    </item>
    <item>
      <title>Re: C Src code giving CORE dump</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/c-src-code-giving-core-dump/m-p/5135465#M688682</link>
      <description>&amp;gt; How are you compiling this without getting a&lt;BR /&gt;&amp;gt; bunch of warnings?&lt;BR /&gt;&lt;BR /&gt;I'm still wondering about this.</description>
      <pubDate>Tue, 14 Oct 2008 11:53:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/c-src-code-giving-core-dump/m-p/5135465#M688682</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2008-10-14T11:53:36Z</dc:date>
    </item>
    <item>
      <title>Re: C Src code giving CORE dump</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/c-src-code-giving-core-dump/m-p/5135466#M688683</link>
      <description>Thanks FOr ur valuble comments, I have included the stdlib.h in my test code and it seems the problem is fixed. Now i am implementing in Applcation source code and going to run the application. &lt;BR /&gt;If any issue arise will update.&lt;BR /&gt;&lt;BR /&gt;Anyway after including the stdlib warning messge has gone.&lt;BR /&gt;Thanks&lt;BR /&gt;Bhushan</description>
      <pubDate>Tue, 14 Oct 2008 11:57:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/c-src-code-giving-core-dump/m-p/5135466#M688683</guid>
      <dc:creator>LeoThe13th</dc:creator>
      <dc:date>2008-10-14T11:57:21Z</dc:date>
    </item>
    <item>
      <title>Re: C Src code giving CORE dump</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/c-src-code-giving-core-dump/m-p/5135467#M688684</link>
      <description>&amp;gt; Anyway after including the stdlib warning&lt;BR /&gt;&amp;gt; messge has gone.&lt;BR /&gt;&lt;BR /&gt;Perhaps that warning, whatever it was, was&lt;BR /&gt;trying to tell you something important.  You&lt;BR /&gt;learned the lesson here, right?</description>
      <pubDate>Tue, 14 Oct 2008 12:09:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/c-src-code-giving-core-dump/m-p/5135467#M688684</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2008-10-14T12:09:27Z</dc:date>
    </item>
    <item>
      <title>Re: C Src code giving CORE dump</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/c-src-code-giving-core-dump/m-p/5135468#M688685</link>
      <description>If you compile this on aCC6, you will get an error if you don't have a prototype for heap routines, because of your issue.&lt;BR /&gt;&lt;BR /&gt;Also, you can use +w64bit and +wlint to check for clean programs.&lt;BR /&gt;&lt;BR /&gt;If you are still on PA, you can download cadvise to do the same things:&lt;BR /&gt;&lt;A href="http://www.hp.com/go/cadvise" target="_blank"&gt;http://www.hp.com/go/cadvise&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;gt;strlen("var/") &lt;BR /&gt;&lt;BR /&gt;You can optimize this to:&lt;BR /&gt;(sizeof("var/")-1)&lt;BR /&gt;&lt;BR /&gt;*PIDfilename = '\0';&lt;BR /&gt;strcat(PIDfilename, "var/");&lt;BR /&gt;&lt;BR /&gt;Instead of doing this null assignment, you should change the first to strcpy(3).</description>
      <pubDate>Wed, 15 Oct 2008 04:50:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/c-src-code-giving-core-dump/m-p/5135468#M688685</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-10-15T04:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: C Src code giving CORE dump</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/c-src-code-giving-core-dump/m-p/5135469#M688686</link>
      <description>Thanks everyone...</description>
      <pubDate>Wed, 15 Oct 2008 04:55:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/c-src-code-giving-core-dump/m-p/5135469#M688686</guid>
      <dc:creator>LeoThe13th</dc:creator>
      <dc:date>2008-10-15T04:55:47Z</dc:date>
    </item>
    <item>
      <title>Re: C Src code giving CORE dump</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/c-src-code-giving-core-dump/m-p/5135470#M688687</link>
      <description>hmm, problems like this should not ever happen. i took a look at the source file and well, it is a small piece of code and it doesn't do complicated things.&lt;BR /&gt;&lt;BR /&gt;for things like this you should simply use a scripting language like perl or python. you could probably turn it into a shell script just as well.&lt;BR /&gt;&lt;BR /&gt;i used to be pretty good at C, but i don't see the need to use it anymore. for admin work there is nothing that can't be done with shell and perl scripting.&lt;BR /&gt;&lt;BR /&gt;even when i fiddle around with desktop apps on linux, this is written in python (with glade/gtk), nobody notices the difference.&lt;BR /&gt;&lt;BR /&gt;it's so easy, fast and you don't have to worry about things like pointers and memory allocations.</description>
      <pubDate>Wed, 15 Oct 2008 06:35:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/c-src-code-giving-core-dump/m-p/5135470#M688687</guid>
      <dc:creator>dirk dierickx</dc:creator>
      <dc:date>2008-10-15T06:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: C Src code giving CORE dump</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/c-src-code-giving-core-dump/m-p/5135471#M688688</link>
      <description>&amp;gt;Dirk: it is a small piece of code and it doesn't do complicated things.&lt;BR /&gt;&lt;BR /&gt;Yes but it must be a small fragment since there would be no reason to compile with +DD64.</description>
      <pubDate>Wed, 15 Oct 2008 06:52:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/c-src-code-giving-core-dump/m-p/5135471#M688688</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-10-15T06:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: C Src code giving CORE dump</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/c-src-code-giving-core-dump/m-p/5135472#M688689</link>
      <description>no reason, yes, but that doesn't make it true.&lt;BR /&gt;&lt;BR /&gt;i'm saying, sometimes people do things out of habbit or because they read it somewhere and applied it without knowing what all the options stand for.</description>
      <pubDate>Fri, 17 Oct 2008 05:21:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/c-src-code-giving-core-dump/m-p/5135472#M688689</guid>
      <dc:creator>dirk dierickx</dc:creator>
      <dc:date>2008-10-17T05:21:12Z</dc:date>
    </item>
  </channel>
</rss>

