- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: getenv
Operating System - Linux
1754144
Members
4048
Online
108811
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
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
тАО02-20-2007 08:05 PM
тАО02-20-2007 08:05 PM
Solution
>can you give suggestion for how to allows put in environment more than one variable .
As I said, just call strdup(3) then putenv(3). And ignore the fact that you may leak if you are setting the same variable with putenv(3).
You'll leak if you call MSP_ListParamByEntity with the same paramElmArray[i].param_name.
If you want to solve Clay's "Chapter Two", you can create an STL map. Where the key is .param_name and the value is the result of strdup. If you find the name in your map and strlen of previous value is >= new value, you can just overwrite it and not call putenv. If not, strdup and putenv, the free the old space and update your map. (You could store the length in the map too.)
As I said, just call strdup(3) then putenv(3). And ignore the fact that you may leak if you are setting the same variable with putenv(3).
You'll leak if you call MSP_ListParamByEntity with the same paramElmArray[i].param_name.
If you want to solve Clay's "Chapter Two", you can create an STL map
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-20-2007 08:17 PM
тАО02-20-2007 08:17 PM
Re: getenv
Oops, I mistakenly assumed that you were using C++. If not, ignore the mention of STL. You would have to invent your own data structure to keep track of leaks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-21-2007 12:37 AM
тАО02-21-2007 12:37 AM
Re: getenv
Hi Dennis,
A lot of thanks for your help.
Regards,
Subrat
A lot of thanks for your help.
Regards,
Subrat
- « Previous
-
- 1
- 2
- Next »
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