summaryrefslogtreecommitdiff
path: root/hurd
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-07-21 10:36:59 +0000
committerUlrich Drepper <drepper@redhat.com>1998-07-21 10:36:59 +0000
commit2b25f93f7ad09ec1c2b93e07ceae577b56b44a80 (patch)
tree3b0aebccfa57d4e42152d5156e759f1204c2339b /hurd
parente4940e6628c088f722df721c9634b55be7405e2c (diff)
Update.
1998-07-20 Jose M. Moya <josem@gnu.org> * hurd/hurdmsg.c (_S_msg_get_env_variable): Copy getenv return value. 1998-07-20 Roland McGrath <roland@baalperazim.frob.com> * sysdeps/mach/hurd/getdomain.c: New file. * sysdeps/mach/hurd/setdomain.c: New file. 1998-07-20 Roland McGrath <roland@baalperazim.frob.com> * sysdeps/unix/bsd/sigsuspend.c: Define __sigsuspend with sigsuspend as a weak alias.
Diffstat (limited to 'hurd')
-rw-r--r--hurd/hurdmsg.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/hurd/hurdmsg.c b/hurd/hurdmsg.c
index 5fac8d4cd3..2348550611 100644
--- a/hurd/hurdmsg.c
+++ b/hurd/hurdmsg.c
@@ -315,14 +315,24 @@ _S_msg_get_env_variable (mach_port_t msgport,
char *variable,
char **data, mach_msg_type_number_t *datalen)
{
+ error_t err;
+ mach_msg_type_number_t valuelen;
const char *value = getenv (variable);
if (value == NULL)
return ENOENT;
- /* XXX this pointer might become invalid */
- *data = value;
- *datalen = strlen (value);
+ valuelen = strlen (value);
+ if (valuelen > *datalen)
+ {
+ if (err = __vm_allocate (__mach_task_self (),
+ (vm_address_t *) data, valuelen, 1))
+ return err;
+ }
+
+ memcpy (*data, value, valuelen);
+ *datalen = valuelen;
+
return 0;
}