c - Can I change the getenv 's return value? -


i want know happened if change memory return getenv

i know not code. know setenv way.

like:

char *new_path = "/home/user/dev/mytry1"; char *path = getenv("path");// assume there : path=/home/user/dev/mytry //now *path = "/home/user/dev/mytry"  memcpy(path,new_path,strlen(new_path)+1); 

is undefined behavior ? or wrong code?

i tried , no error or segmentation fault happened.

no, can't. documentation:

conforming applications required not modify environ directly, use functions described here manipulate process environment abstract object.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -