Print this page
4337 eliminate /etc/TIMEZONE

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/login/login.c
          +++ new/usr/src/cmd/login/login.c
↓ open down ↓ 2205 lines elided ↑ open up ↑
2206 2206                  char *tp = getenv("TERM");
2207 2207  
2208 2208                  if ((tp != NULL) && (*tp != '\0'))
2209 2209                          ENVSTRNCAT(term, tp);
2210 2210          }
2211 2211  
2212 2212          ENVSTRNCAT(logname, pwd->pw_name);
2213 2213  
2214 2214          /*
2215 2215           * There are three places to get timezone info.  init.c sets
2216      -         * TZ if the file /etc/TIMEZONE contains a value for TZ.
     2216 +         * TZ if the file /etc/default/init contains a value for TZ.
2217 2217           * login.c looks in the file /etc/default/login for a
2218 2218           * variable called TIMEZONE being set.  If TIMEZONE has a
2219 2219           *  value, TZ is set to that value; no environment variable
2220 2220           * TIMEZONE is set, only TZ.  If neither of these methods
2221 2221           * work to set TZ, then the library routines  will default
2222 2222           * to using the file /usr/lib/locale/TZ/localtime.
2223 2223           *
2224      -         * There is a priority set up here.  If /etc/TIMEZONE has
     2224 +         * There is a priority set up here.  If /etc/default/init has
2225 2225           * a value for TZ, that value remains top priority.  If the
2226 2226           * file /etc/default/login has TIMEZONE set, that has second
2227 2227           * highest priority not overriding the value of TZ in
2228      -         * /etc/TIMEZONE.  The reason for this priority is that the
2229      -         * file /etc/TIMEZONE is supposed to be sourced by
     2228 +         * /etc/default/init.  The reason for this priority is that the
     2229 +         * file /etc/default/init is supposed to be sourced by
2230 2230           * /etc/profile.  We are doing the "sourcing" prematurely in
2231 2231           * init.c.  Additionally, a login C shell doesn't source the
2232      -         * file /etc/profile thus not sourcing /etc/TIMEZONE thus not
     2232 +         * file /etc/profile thus not sourcing /etc/default/init thus not
2233 2233           * allowing an adminstrator to globally set TZ for all users
2234 2234           */
2235 2235          if (Def_tz != NULL)     /* Is there a TZ from defaults/login? */
2236 2236                  tmp_tz = Def_tz;
2237 2237  
2238 2238          if ((Def_tz = getenv("TZ")) != NULL) {
2239 2239                  ENVSTRNCAT(timez, Def_tz);
2240 2240          } else if (tmp_tz != NULL) {
2241 2241                  Def_tz = tmp_tz;
2242 2242                  ENVSTRNCAT(timez, Def_tz);
↓ open down ↓ 309 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX