System.java: (getenv0): New method.
2004-06-14 Andrew Haley <aph@redhat.com> * java/lang/System.java: (getenv0): New method. (getenv): Add security check. Do the right thing. * java/lang/natSystem.cc (getenv0): New method. From-SVN: r83107
This commit is contained in:
committed by
Andrew Haley
parent
50431bc428
commit
df94fa14b9
@@ -142,3 +142,16 @@ java::lang::System::isWordsBigEndian (void)
|
||||
u.lval = 1;
|
||||
return u.cval == 0;
|
||||
}
|
||||
|
||||
jstring
|
||||
java::lang::System::getenv0 (jstring name)
|
||||
{
|
||||
jint len = _Jv_GetStringUTFLength (name);
|
||||
char buf[len + 1];
|
||||
jsize total = JvGetStringUTFRegion (name, 0, name->length(), buf);
|
||||
buf[total] = '\0';
|
||||
const char *value = ::getenv (buf);
|
||||
if (value == NULL)
|
||||
return NULL;
|
||||
return JvNewStringLatin1 (value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user