summaryrefslogtreecommitdiffstats
path: root/newlib/libc/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdlib')
-rw-r--r--newlib/libc/stdlib/setenv_r.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/newlib/libc/stdlib/setenv_r.c b/newlib/libc/stdlib/setenv_r.c
index 6cc18a868..f06dc6772 100644
--- a/newlib/libc/stdlib/setenv_r.c
+++ b/newlib/libc/stdlib/setenv_r.c
@@ -1,5 +1,5 @@
/* This file may have been modified by DJ Delorie (Jan 1991). If so,
-** these modifications are Copyright (C) 1991 DJ Delorie
+** these modifications are Copyright (C) 1991 DJ Delorie.
*/
/*
@@ -26,6 +26,7 @@
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
+#include <time.h>
#include "envlock.h"
extern char **environ;
@@ -69,8 +70,11 @@ _DEFUN (_setenv_r, (reent_ptr, name, value, rewrite),
}
if (strlen (C) >= l_value)
{ /* old larger; copy over */
- while ((*C++ = *value++) != 0);
+ while ((*C++ = *value++) != 0);
ENV_UNLOCK;
+ /* if we are changing the TZ environment variable, update timezone info */
+ if (strcmp (name, "TZ") == 0)
+ tzset ();
return 0;
}
}
@@ -117,6 +121,10 @@ _DEFUN (_setenv_r, (reent_ptr, name, value, rewrite),
ENV_UNLOCK;
+ /* if we are setting the TZ environment variable, update timezone info */
+ if (strcmp (name, "TZ") == 0)
+ tzset ();
+
return 0;
}