...
| Wiki Markup |
|---|
Note that this example also violates rule \[[DCL30-C. DoDeclare notobjects referwith toappropriate an object outside of its lifetimestorage durations]\]. |
| Code Block | ||
|---|---|---|
| ||
int func(char *var) {
char env[1024];
if (snprintf(env, sizeof(env),"TEST=%s", var) < 0) {
/* Handle Error */
}
return putenv(env);
}
|
...
| Wiki Markup |
|---|
\[[Open Group 04|AA. C++ References#Open Group 04]\] The putenv() function \[[ISO/IEC 9899-1999|AA. C References#ISO/IEC 9899-1999]\] Section 6.2.4, "Storage durations of objects," and Section 7.20.3, "Memory management functions" \[[Dowd|AA. C References#Dowd 06]\] Chapter 10, "UNIX Processes" (Confusing putenv() and setenv()) \[[DCL30-C. DoDeclare notobjects referwith toappropriate an object outside of its lifetimestorage durations]\] |