- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- local variables values disapearing after calling a...
Operating System - Linux
1823177
Members
3976
Online
109647
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-09-2007 10:45 PM
тАО07-09-2007 10:45 PM
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);
for the first time it returns the values from the xml and fills the variables with the find tag function.
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;
char *passwd_text;
char *osid_text;
is gone, as you will see in the piece of the log file that i posted below:
before calling the xml reader for the second time :
dados a repetidos: (bdsn), (bdsn), (oesis)
after calling the xml reader function for the second time, these values (bdsn), (bdsn), (oesis) are missing
dados finales: (), (), (), (50)
thanks
elementoestrutura xmlelementos_oracle_bd[BIG_ENOUGH];
elementoestrutura xmlelementos_limites[BIG_ENOUGH];
char *usr_text;
char *passwd_text;
char *osid_text;
char *num_advertencias;
//ler o ficheiro de configuracao e sacar usr,passwd,osid
text_count=0;
LIBXML_TEST_VERSION
streamFileXML(CONFIG_FILE_NAME,ORACLE_BD_TAG,xmlelementos_oracle_bd);
xmlCleanupParser();
xmlMemoryDump();
usr_text=findtag("user",xmlelementos_oracle_bd);
passwd_text=findtag("passwd",xmlelementos_oracle_bd);
osid_text=findtag("osid",xmlelementos_oracle_bd);
sprintf( sstring, "dados a sem ser rep: (%s), (%s), (%s)", usr_text, passwd_text,osid_text);
log_message(LOG_FILE,sstring);
usr_text=findtag("user",xmlelementos_oracle_bd);
passwd_text=findtag("passwd",xmlelementos_oracle_bd);
osid_text=findtag("osid",xmlelementos_oracle_bd);
sprintf( sstring, "dados a repetidos: (%s), (%s), (%s)", usr_text, passwd_text,osid_text);
log_message(LOG_FILE,sstring);
text_count=0;
LIBXML_TEST_VERSION
streamFileXML(CONFIG_FILE_NAME,LIMITES_TAG,xmlelementos_limites);
xmlCleanupParser();
xmlMemoryDump();
num_advertencias=findtag("num_advertencias",xmlelementos_limites);
sprintf( sstring, "dados finales: (%s), (%s), (%s), (%s)",usr_text, passwd_text,osid_text ,num_advertencias);
log_message(LOG_FILE,sstring);
this is the log file created during the execution
[]-pedro:/home/pedro/bin>cat daemon.log
iniciar o daemonize
sprintf : demonio iniciado: Tue Jul 10 12:16:10 2007
lock file
drop user
fork off
fork off
exit parent
executando como filhos
umask
SETSID
CHDIR
el salir daemonize la funci├│n
crear la llave
iniciar el sem├бforo
estoy leyendo el conf.xml por primera vez
Text Count----->0
Text Count----->1
Text Count----->2
Oracle_name----->oracle_bd
entrei aqui
dados elemento==tag : (user)==(user) <<---->> (bdsn)
entrei aqui
dados elemento==tag : (passwd)==(user) <<---->> (bdsn)
dados elemento==tag : (passwd)==(passwd) <<---->> (bdsn)
entrei aqui
dados elemento==tag : (osid)==(user) <<---->> (bdsn)
dados elemento==tag : (osid)==(passwd) <<---->> (bdsn)
dados elemento==tag : (osid)==(osid) <<---->> (oesis)
dados a sem ser rep: (bdsn), (bdsn), (oesis)
entrei aqui
dados elemento==tag : (user)==(user) <<---->> (bdsn)
entrei aqui
dados elemento==tag : (passwd)==(user) <<---->> (bdsn)
dados elemento==tag : (passwd)==(passwd) <<---->> (bdsn)
entrei aqui
dados elemento==tag : (osid)==(user) <<---->> (bdsn)
dados elemento==tag : (osid)==(passwd) <<---->> (bdsn)
dados elemento==tag : (osid)==(osid) <<---->> (oesis)
dados a repetidos: (bdsn), (bdsn), (oesis)
Text Count----->0
Oracle_name----->limites
entrei aqui
dados elemento==tag : (num_advertencias)==(num_advertencias) <<---->> (50)
dados finales: (
), (), (), (50)
vou ficar a escrever na memoria ate que doa a barriga
[]-pedro:/home/pedro/bin>
this is the find tag function that goes to the array that was filled by the xml reader function
char * findtag(char * tag,elementoestrutura xmlelementos[])
{
char sstring[200];
char * texto;
int i =0;
log_message(LOG_FILE,"entrei aqui");
while(i< BIG_ENOUGH)
{
sprintf(sstring, "dados elemento==tag : (%s)==(%s) <<---->> (%s)", tag, xmlelementos[i].elemento,xmlelementos[i].texto);
log_message(LOG_FILE,sstring);
if(strcmp(tag,xmlelementos[i].elemento)==0)
{
texto=xmlelementos[i].texto;
return texto;
}
i++;
}
return "erro no XML";
}
SLB SLB SLB Glorioso
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-09-2007 10:56 PM
тАО07-09-2007 10:56 PM
Solution
Shalom,
I can't debug your code.
If variables are being stepped on, check the specifications on the library and make sure you are not using names reserved by the library.
sEP
I can't debug your code.
If variables are being stepped on, check the specifications on the library and make sure you are not using names reserved by the library.
sEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-10-2007 12:03 AM
тАО07-10-2007 12:03 AM
Re: local variables values disapearing after calling a function that uses libxml2
What OS version are you on?
If you are on IPF, you can use a real compiler that has +check=bounds +check=stack to catch this type of corruption.
>SEP: If variables are being stepped on,
You can also set a hardware watch point to see who overwrites these variables.
If you are on IPF, you can use a real compiler that has +check=bounds +check=stack to catch this type of corruption.
>SEP: If variables are being stepped on,
You can also set a hardware watch point to see who overwrites these variables.
- Tags:
- +check
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-10-2007 12:04 AM
тАО07-10-2007 12:04 AM
Re: local variables values disapearing after calling a function that uses libxml2
Is sstring big enough?
char sstring[200];
sprintf(sstring, "dados elemento==tag : (%s)==(%s) <<---->> (%s)", tag,
You may want to use snprintf, where you pass the size of sstring to prevent it from going out of bounds.
char sstring[200];
sprintf(sstring, "dados elemento==tag : (%s)==(%s) <<---->> (%s)", tag,
You may want to use snprintf, where you pass the size of sstring to prevent it from going out of bounds.
- Tags:
- sprintf
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP