- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: SIGABRT in getenv
Operating System - HP-UX
1758028
Members
2018
Online
108866
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
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
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-12-2002 04:06 AM
тАО07-12-2002 04:06 AM
SIGABRT in getenv
My application receives a SIGABRT in 'getenv()' when checking a environment variable, which is not set. Problem goes away if:
1. The variable is set. (no matter to what value)
2. I do not use a feature of my application which does fork() and execlp() (among some other things).
here is the stacktrace...
gdb) bt
#0 0xc0112100 in _kill () from /usr/lib/libc.2
#1 0xc00af6dc in raise () from /usr/lib/libc.2
#2 0xc00efd5c in _abort_C () from /usr/lib/libc.2
#3 0xc00efdb4 in abort () from /usr/lib/libc.2
#4 0x4ba9f8 in ?? ()
#5
#6 0xc0095fc4 in getenv () from /usr/lib/libc.2
#7 0xe9030 in main (argc=8, argv=0x7f7e0548, No.Identifier=0x7f7e056c) at backint.cpp:373
(gdb) i thr
* 1 system thread 2497 0xc0112100 in _kill () from /usr/lib/libc.2
(gdb)
This is the last action (of quite a lot of ;-) of this program. All other threads have finished. Prior calls to 'getenv()' (e.g. during startup) have succeeded. Tried to iterate through 'environ' - gives the same error. It looks like 'environ' is not correctly terminated (no zero length entry at the end). Don't know if this is a bug in HP-UX or my application. This all is on HP-UX 11.00 32-bit.
Thomas Prause
1. The variable is set. (no matter to what value)
2. I do not use a feature of my application which does fork() and execlp() (among some other things).
here is the stacktrace...
gdb) bt
#0 0xc0112100 in _kill () from /usr/lib/libc.2
#1 0xc00af6dc in raise () from /usr/lib/libc.2
#2 0xc00efd5c in _abort_C () from /usr/lib/libc.2
#3 0xc00efdb4 in abort () from /usr/lib/libc.2
#4 0x4ba9f8 in ?? ()
#5
#6 0xc0095fc4 in getenv () from /usr/lib/libc.2
#7 0xe9030 in main (argc=8, argv=0x7f7e0548, No.Identifier=0x7f7e056c) at backint.cpp:373
(gdb) i thr
* 1 system thread 2497 0xc0112100 in _kill () from /usr/lib/libc.2
(gdb)
This is the last action (of quite a lot of ;-) of this program. All other threads have finished. Prior calls to 'getenv()' (e.g. during startup) have succeeded. Tried to iterate through 'environ' - gives the same error. It looks like 'environ' is not correctly terminated (no zero length entry at the end). Don't know if this is a bug in HP-UX or my application. This all is on HP-UX 11.00 32-bit.
Thomas Prause
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-12-2002 05:47 AM
тАО07-12-2002 05:47 AM
Re: SIGABRT in getenv
My first thought is that you have done a putenv() using an auto declared variable that has gone out of scope.
If it ain't broke, I can fix that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-14-2002 11:46 PM
тАО07-14-2002 11:46 PM
Re: SIGABRT in getenv
Close, but ...
I call 'putenv()' two times. I changed these calls to allocate memory like:
char *my_env = new char[strlen(my_var) +1];
strcpy(my_env, my_var);
putenv(my_env);
'my_env' is never released - this should result in a memleak. But still no success. Removed my signal handler to see the orignal signal is a SIGSEGV in 'getenv()'. Used the debugger to step through 'environ' from the core: After the last valid env. vars. there are TWO invalid pointers before the end of 'environ' is marked w/ a null pointer. It looks like the allocated memory has been freed by someone else. Perplexed ...
Thomas
I call 'putenv()' two times. I changed these calls to allocate memory like:
char *my_env = new char[strlen(my_var) +1];
strcpy(my_env, my_var);
putenv(my_env);
'my_env' is never released - this should result in a memleak. But still no success. Removed my signal handler to see the orignal signal is a SIGSEGV in 'getenv()'. Used the debugger to step through 'environ' from the core: After the last valid env. vars. there are TWO invalid pointers before the end of 'environ' is marked w/ a null pointer. It looks like the allocated memory has been freed by someone else. Perplexed ...
Thomas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-15-2002 03:49 AM
тАО07-15-2002 03:49 AM
Re: SIGABRT in getenv
OK, it has been solved:
Another part of the application has overwritten the env. vars, w/ identical content (quite difficult to find). But when this part finished, the memory for the vars. went out of scope.
Thanks.
Another part of the application has overwritten the env. vars, w/ identical content (quite difficult to find). But when this part finished, the memory for the vars. went out of scope.
Thanks.
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.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP