<?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: local variables values disapearing after calling a function that uses libxml2 in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/local-variables-values-disapearing-after-calling-a-function-that/m-p/4034757#M93901</link>
    <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;I can't debug your code.&lt;BR /&gt;&lt;BR /&gt;If variables are being stepped on, check the specifications on the library and make sure you are not using names reserved by the library.&lt;BR /&gt;&lt;BR /&gt;sEP</description>
    <pubDate>Tue, 10 Jul 2007 05:56:30 GMT</pubDate>
    <dc:creator>Steven E. Protter</dc:creator>
    <dc:date>2007-07-10T05:56:30Z</dc:date>
    <item>
      <title>local variables values disapearing after calling a function that uses libxml2</title>
      <link>https://community.hpe.com/t5/operating-system-linux/local-variables-values-disapearing-after-calling-a-function-that/m-p/4034756#M93900</link>
      <description>&lt;BR /&gt;&lt;BR /&gt;what is happening is that i am creating some local variables char * user_txt, and when i call the function streamFileXML(CONFIG_FILE_NAME,ORACLE_BD_TAG,xmlelementos_oracle_bd);   &lt;BR /&gt;for the first time it returns the values from the xml and fills the variables with the find tag function.&lt;BR /&gt;&lt;BR /&gt;the problem occurs when i call streamFileXML(CONFIG_FILE_NAME,LIMITES_TAG,xmlelementos_limites); a second time but this time i am reading another tag from the xml, it returns the right values, but the value of the local variables     char *usr_text;&lt;BR /&gt;    char *passwd_text;&lt;BR /&gt;    char *osid_text;&lt;BR /&gt;is gone, as you will see in the piece of the log file that i posted below:&lt;BR /&gt;&lt;BR /&gt;before calling the xml reader for the second time :&lt;BR /&gt;dados a repetidos: (bdsn), (bdsn), (oesis)&lt;BR /&gt;&lt;BR /&gt;after calling the xml reader function for the second time, these values (bdsn), (bdsn), (oesis) are missing &lt;BR /&gt;&lt;BR /&gt;dados finales: (), (), (), (50)&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;&lt;BR /&gt;elementoestrutura xmlelementos_oracle_bd[BIG_ENOUGH];&lt;BR /&gt;    elementoestrutura xmlelementos_limites[BIG_ENOUGH];&lt;BR /&gt;    &lt;BR /&gt;    char *usr_text;&lt;BR /&gt;    char *passwd_text;&lt;BR /&gt;    char *osid_text;&lt;BR /&gt;    char *num_advertencias;&lt;BR /&gt;    &lt;BR /&gt;     //ler o ficheiro de configuracao e sacar usr,passwd,osid&lt;BR /&gt;     &lt;BR /&gt;       &lt;BR /&gt;     text_count=0;&lt;BR /&gt;     LIBXML_TEST_VERSION&lt;BR /&gt;     &lt;BR /&gt;     streamFileXML(CONFIG_FILE_NAME,ORACLE_BD_TAG,xmlelementos_oracle_bd);    &lt;BR /&gt;     &lt;BR /&gt;     xmlCleanupParser();&lt;BR /&gt;     xmlMemoryDump(); &lt;BR /&gt;&lt;BR /&gt;      &lt;BR /&gt;     usr_text=findtag("user",xmlelementos_oracle_bd);&lt;BR /&gt;     passwd_text=findtag("passwd",xmlelementos_oracle_bd); &lt;BR /&gt;     osid_text=findtag("osid",xmlelementos_oracle_bd);     &lt;BR /&gt;      &lt;BR /&gt;            &lt;BR /&gt;     sprintf( sstring, "dados a  sem ser rep: (%s), (%s), (%s)", usr_text, passwd_text,osid_text);&lt;BR /&gt;      &lt;BR /&gt;     log_message(LOG_FILE,sstring); &lt;BR /&gt;     usr_text=findtag("user",xmlelementos_oracle_bd);&lt;BR /&gt;     passwd_text=findtag("passwd",xmlelementos_oracle_bd); &lt;BR /&gt;     osid_text=findtag("osid",xmlelementos_oracle_bd);           &lt;BR /&gt;      &lt;BR /&gt;     sprintf( sstring, "dados a repetidos: (%s), (%s), (%s)", usr_text, passwd_text,osid_text);  &lt;BR /&gt;     log_message(LOG_FILE,sstring); &lt;BR /&gt;      &lt;BR /&gt;     text_count=0;&lt;BR /&gt;     &lt;BR /&gt;     LIBXML_TEST_VERSION  &lt;BR /&gt;     &lt;BR /&gt;     streamFileXML(CONFIG_FILE_NAME,LIMITES_TAG,xmlelementos_limites);&lt;BR /&gt;                    &lt;BR /&gt;     xmlCleanupParser();&lt;BR /&gt;     xmlMemoryDump();  &lt;BR /&gt;&lt;BR /&gt;      num_advertencias=findtag("num_advertencias",xmlelementos_limites);&lt;BR /&gt;                  &lt;BR /&gt;      sprintf( sstring, "dados finales: (%s), (%s), (%s), (%s)",usr_text, passwd_text,osid_text ,num_advertencias); &lt;BR /&gt;      log_message(LOG_FILE,sstring); &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;this is the log file created during the execution&lt;BR /&gt;&lt;BR /&gt;[]-pedro:/home/pedro/bin&amp;gt;cat daemon.log &lt;BR /&gt;iniciar o daemonize&lt;BR /&gt;sprintf : demonio iniciado: Tue Jul 10 12:16:10 2007&lt;BR /&gt;&lt;BR /&gt;lock file&lt;BR /&gt;drop user&lt;BR /&gt;fork off&lt;BR /&gt;fork off&lt;BR /&gt;exit parent&lt;BR /&gt;executando como filhos&lt;BR /&gt;umask&lt;BR /&gt;SETSID&lt;BR /&gt;CHDIR&lt;BR /&gt;el salir daemonize la función&lt;BR /&gt;crear la llave&lt;BR /&gt;iniciar el semáforo&lt;BR /&gt;estoy leyendo el conf.xml por primera vez&lt;BR /&gt;Text Count-----&amp;gt;0&lt;BR /&gt;Text Count-----&amp;gt;1&lt;BR /&gt;Text Count-----&amp;gt;2&lt;BR /&gt;Oracle_name-----&amp;gt;oracle_bd&lt;BR /&gt;entrei aqui&lt;BR /&gt;dados elemento==tag : (user)==(user) &amp;lt;&amp;lt;----&amp;gt;&amp;gt; (bdsn)&lt;BR /&gt;entrei aqui&lt;BR /&gt;dados elemento==tag : (passwd)==(user) &amp;lt;&amp;lt;----&amp;gt;&amp;gt; (bdsn)&lt;BR /&gt;dados elemento==tag : (passwd)==(passwd) &amp;lt;&amp;lt;----&amp;gt;&amp;gt; (bdsn)&lt;BR /&gt;entrei aqui&lt;BR /&gt;dados elemento==tag : (osid)==(user) &amp;lt;&amp;lt;----&amp;gt;&amp;gt; (bdsn)&lt;BR /&gt;dados elemento==tag : (osid)==(passwd) &amp;lt;&amp;lt;----&amp;gt;&amp;gt; (bdsn)&lt;BR /&gt;dados elemento==tag : (osid)==(osid) &amp;lt;&amp;lt;----&amp;gt;&amp;gt; (oesis)&lt;BR /&gt;dados a  sem ser rep: (bdsn), (bdsn), (oesis)&lt;BR /&gt;entrei aqui&lt;BR /&gt;dados elemento==tag : (user)==(user) &amp;lt;&amp;lt;----&amp;gt;&amp;gt; (bdsn)&lt;BR /&gt;entrei aqui&lt;BR /&gt;dados elemento==tag : (passwd)==(user) &amp;lt;&amp;lt;----&amp;gt;&amp;gt; (bdsn)&lt;BR /&gt;dados elemento==tag : (passwd)==(passwd) &amp;lt;&amp;lt;----&amp;gt;&amp;gt; (bdsn)&lt;BR /&gt;entrei aqui&lt;BR /&gt;dados elemento==tag : (osid)==(user) &amp;lt;&amp;lt;----&amp;gt;&amp;gt; (bdsn)&lt;BR /&gt;dados elemento==tag : (osid)==(passwd) &amp;lt;&amp;lt;----&amp;gt;&amp;gt; (bdsn)&lt;BR /&gt;dados elemento==tag : (osid)==(osid) &amp;lt;&amp;lt;----&amp;gt;&amp;gt; (oesis)&lt;BR /&gt;dados a repetidos: (bdsn), (bdsn), (oesis)&lt;BR /&gt;Text Count-----&amp;gt;0&lt;BR /&gt;Oracle_name-----&amp;gt;limites&lt;BR /&gt;entrei aqui&lt;BR /&gt;dados elemento==tag : (num_advertencias)==(num_advertencias) &amp;lt;&amp;lt;----&amp;gt;&amp;gt; (50)&lt;BR /&gt;dados finales: (&lt;BR /&gt;        ), (), (), (50)&lt;BR /&gt;vou ficar a escrever na memoria  ate que doa a barriga&lt;BR /&gt;[]-pedro:/home/pedro/bin&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;this is the find tag function that goes to the array that was filled by the xml reader function&lt;BR /&gt;&lt;BR /&gt;char * findtag(char * tag,elementoestrutura xmlelementos[])&lt;BR /&gt;{&lt;BR /&gt;   char sstring[200];&lt;BR /&gt;   char * texto;&lt;BR /&gt;    int i =0;    &lt;BR /&gt;    &lt;BR /&gt;     log_message(LOG_FILE,"entrei aqui"); &lt;BR /&gt;    while(i&amp;lt; BIG_ENOUGH)&lt;BR /&gt;    {      &lt;BR /&gt;&lt;BR /&gt;      sprintf(sstring, "dados elemento==tag : (%s)==(%s) &amp;lt;&amp;lt;----&amp;gt;&amp;gt; (%s)", tag, xmlelementos[i].elemento,xmlelementos[i].texto); &lt;BR /&gt;      log_message(LOG_FILE,sstring); &lt;BR /&gt;       if(strcmp(tag,xmlelementos[i].elemento)==0)&lt;BR /&gt;       {&lt;BR /&gt;           texto=xmlelementos[i].texto;&lt;BR /&gt;           return texto;&lt;BR /&gt;       }       &lt;BR /&gt;&lt;BR /&gt;       i++;              &lt;BR /&gt;     }     &lt;BR /&gt;     return "erro no XML";    &lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 10 Jul 2007 05:45:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/local-variables-values-disapearing-after-calling-a-function-that/m-p/4034756#M93900</guid>
      <dc:creator>Pedro Dinis</dc:creator>
      <dc:date>2007-07-10T05:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: local variables values disapearing after calling a function that uses libxml2</title>
      <link>https://community.hpe.com/t5/operating-system-linux/local-variables-values-disapearing-after-calling-a-function-that/m-p/4034757#M93901</link>
      <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;I can't debug your code.&lt;BR /&gt;&lt;BR /&gt;If variables are being stepped on, check the specifications on the library and make sure you are not using names reserved by the library.&lt;BR /&gt;&lt;BR /&gt;sEP</description>
      <pubDate>Tue, 10 Jul 2007 05:56:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/local-variables-values-disapearing-after-calling-a-function-that/m-p/4034757#M93901</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2007-07-10T05:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: local variables values disapearing after calling a function that uses libxml2</title>
      <link>https://community.hpe.com/t5/operating-system-linux/local-variables-values-disapearing-after-calling-a-function-that/m-p/4034758#M93902</link>
      <description>What OS version are you on?&lt;BR /&gt;If you are on IPF, you can use a real compiler that has +check=bounds +check=stack to catch this type of corruption.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;SEP:  If variables are being stepped on,&lt;BR /&gt;&lt;BR /&gt;You can also set a hardware watch point to see who overwrites these variables.</description>
      <pubDate>Tue, 10 Jul 2007 07:03:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/local-variables-values-disapearing-after-calling-a-function-that/m-p/4034758#M93902</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-07-10T07:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: local variables values disapearing after calling a function that uses libxml2</title>
      <link>https://community.hpe.com/t5/operating-system-linux/local-variables-values-disapearing-after-calling-a-function-that/m-p/4034759#M93903</link>
      <description>Is sstring big enough?&lt;BR /&gt;char sstring[200];&lt;BR /&gt;sprintf(sstring, "dados elemento==tag : (%s)==(%s) &amp;lt;&amp;lt;----&amp;gt;&amp;gt; (%s)", tag,&lt;BR /&gt;&lt;BR /&gt;You may want to use snprintf, where you pass the size of sstring to prevent it from going out of bounds.</description>
      <pubDate>Tue, 10 Jul 2007 07:04:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/local-variables-values-disapearing-after-calling-a-function-that/m-p/4034759#M93903</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-07-10T07:04:57Z</dc:date>
    </item>
  </channel>
</rss>

