Print this page
4337 eliminate /etc/TIMEZONE

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/listen/listen.c
          +++ new/usr/src/cmd/listen/listen.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * When distributing Covered Code, include this CDDL HEADER in each
  15   15   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16   16   * If applicable, add the following below this CDDL HEADER, with the
  17   17   * fields enclosed by brackets "[]" replaced with your own identifying
  18   18   * information: Portions Copyright [yyyy] [name of copyright owner]
  19   19   *
  20   20   * CDDL HEADER END
  21   21   */
  22   22  
  23   23  /*
       24 + * Copyright 2014 Garrett D'Amore
       25 + */
       26 +/*
  24   27   * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  25   28   * Use is subject to license terms.
  26   29   */
  27   30  
  28   31  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  29   32  /*        All Rights Reserved   */
  30   33  
  31      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  32      -
  33   34  /*
  34   35   * Network Listener Process
  35   36   *
  36   37   *              command line:
  37   38   *
  38   39   *              listen [ -m minor_prefix ] netspec
  39   40   *
  40   41   */
  41   42  
  42   43  /* system include files */
↓ open down ↓ 107 lines elided ↑ open up ↑
 150  151  
 151  152  int     Splflag;                /* logfile critical region flag           */
 152  153  
 153  154  static char *badnspmsg = "Bad netspec on command line ( Pathname too long )";
 154  155  static char *badstart  = "Listener failed to start properly";
 155  156  static char *nologfile = "Unable to open listener log file during initialization";
 156  157  static char *usage     = "Usage: listen [ -m minor_prefix ] network_device";
 157  158  static char *nopmtag   = "Fatal error: Unable to get PMTAG from environment";
 158  159  static char tzenv[BUFSIZ];
 159  160  
 160      -#define TIMEZONE        "/etc/TIMEZONE"
      161 +#define TZFILE  "/etc/default/init"
 161  162  #define TZSTR   "TZ="
 162  163  
 163  164  void    check_sac_mesg();       /* routine to process messages from sac */
 164  165  void    rpc_register();         /* routine to register rpc services */
 165  166  void    rpc_unregister();       /* routine to unregister rpc services */
 166  167  extern  struct  netconfig       *getnetconfigent();
 167  168  extern  char    *t_alloc();
 168  169  extern  void    logexit();
 169  170  extern  int     t_errno;
 170  171  extern  int     errno;
↓ open down ↓ 122 lines elided ↑ open up ↑
 293  294          if (!Logfp)
 294  295  #endif
 295  296                  logexit(1, badstart);
 296  297  
 297  298  /*
 298  299   * In case we started with no environment, find out what timezone we're
 299  300   * in.  This will get passed to children, so only need to do once.
 300  301   */
 301  302  
 302  303          if (getenv("TZ") == NULL) {
 303      -                fp = fopen(TIMEZONE, "r");
      304 +                fp = fopen(TZFILE, "r");
 304  305                  if (fp) {
 305  306                          while (fgets(tzenv, BUFSIZ, fp)) {
 306  307                                  if (tzenv[strlen(tzenv) - 1] == '\n')
 307  308                                          tzenv[strlen(tzenv) - 1] = '\0';
 308  309                                  if (!strncmp(TZSTR, tzenv, strlen(TZSTR))) {
 309  310                                          putenv(parse(tzenv));
 310  311                                          break;
 311  312                                  }
 312  313                          }
 313  314                          fclose(fp);
 314  315                  }
 315  316                  else {
 316      -                        sprintf(scratch, "couldn't open %s, default to GMT", TIMEZONE);
      317 +                        sprintf(scratch, "couldn't open %s, default to GMT",
      318 +                            TZFILE);
 317  319                          logmessage(scratch);
 318  320                  }
 319  321          }
 320  322  
 321  323          logmessage("@(#)listen:listen.c 1.19.9.1");
 322  324  
 323  325  #ifdef  DEBUGMODE
 324  326          logmessage("Listener process with DEBUG capability");
 325  327  #endif
 326  328  
↓ open down ↓ 1237 lines elided ↑ open up ↑
1564 1566          char *tp;
1565 1567          char scratch[BUFSIZ];
1566 1568          int delim;
1567 1569  
1568 1570          tp = p = s + strlen("TZ=");     /* skip TZ= in parsing */
1569 1571          if ((*p == '"') || (*p == '\'')) {
1570 1572                  /* it is quoted */
1571 1573                  delim = *p++;
1572 1574                  for (;;) {
1573 1575                          if (*p == '\0') {
1574      -                                /* etc/TIMEZONE ill-formed, go without TZ */
1575      -                                sprintf(scratch, "%s ill-formed", TIMEZONE);
     1576 +                                /* etc/default/init ill-formed, go without TZ */
     1577 +                                sprintf(scratch, "%s ill-formed", TZFILE);
1576 1578                                  logmessage(scratch);
1577 1579                                  strcpy(s, "TZ=");
1578 1580                                  return(s);
1579 1581                          }
1580 1582                          if (*p == delim) {
1581 1583                                  *tp = '\0';
1582 1584                                  return(s);
1583 1585                          }
1584 1586                          else {
1585 1587                                  *tp++ = *p++;
↓ open down ↓ 402 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX