Print this page
4337 eliminate /etc/TIMEZONE
*** 19,37 ****
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
- #pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* Network Listener Process
*
* command line:
*
--- 19,38 ----
*
* CDDL HEADER END
*/
/*
+ * Copyright 2014 Garrett D'Amore
+ */
+ /*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Network Listener Process
*
* command line:
*
*** 155,165 ****
static char *nologfile = "Unable to open listener log file during initialization";
static char *usage = "Usage: listen [ -m minor_prefix ] network_device";
static char *nopmtag = "Fatal error: Unable to get PMTAG from environment";
static char tzenv[BUFSIZ];
! #define TIMEZONE "/etc/TIMEZONE"
#define TZSTR "TZ="
void check_sac_mesg(); /* routine to process messages from sac */
void rpc_register(); /* routine to register rpc services */
void rpc_unregister(); /* routine to unregister rpc services */
--- 156,166 ----
static char *nologfile = "Unable to open listener log file during initialization";
static char *usage = "Usage: listen [ -m minor_prefix ] network_device";
static char *nopmtag = "Fatal error: Unable to get PMTAG from environment";
static char tzenv[BUFSIZ];
! #define TZFILE "/etc/default/init"
#define TZSTR "TZ="
void check_sac_mesg(); /* routine to process messages from sac */
void rpc_register(); /* routine to register rpc services */
void rpc_unregister(); /* routine to unregister rpc services */
*** 298,308 ****
* In case we started with no environment, find out what timezone we're
* in. This will get passed to children, so only need to do once.
*/
if (getenv("TZ") == NULL) {
! fp = fopen(TIMEZONE, "r");
if (fp) {
while (fgets(tzenv, BUFSIZ, fp)) {
if (tzenv[strlen(tzenv) - 1] == '\n')
tzenv[strlen(tzenv) - 1] = '\0';
if (!strncmp(TZSTR, tzenv, strlen(TZSTR))) {
--- 299,309 ----
* In case we started with no environment, find out what timezone we're
* in. This will get passed to children, so only need to do once.
*/
if (getenv("TZ") == NULL) {
! fp = fopen(TZFILE, "r");
if (fp) {
while (fgets(tzenv, BUFSIZ, fp)) {
if (tzenv[strlen(tzenv) - 1] == '\n')
tzenv[strlen(tzenv) - 1] = '\0';
if (!strncmp(TZSTR, tzenv, strlen(TZSTR))) {
*** 311,321 ****
}
}
fclose(fp);
}
else {
! sprintf(scratch, "couldn't open %s, default to GMT", TIMEZONE);
logmessage(scratch);
}
}
logmessage("@(#)listen:listen.c 1.19.9.1");
--- 312,323 ----
}
}
fclose(fp);
}
else {
! sprintf(scratch, "couldn't open %s, default to GMT",
! TZFILE);
logmessage(scratch);
}
}
logmessage("@(#)listen:listen.c 1.19.9.1");
*** 1569,1580 ****
if ((*p == '"') || (*p == '\'')) {
/* it is quoted */
delim = *p++;
for (;;) {
if (*p == '\0') {
! /* etc/TIMEZONE ill-formed, go without TZ */
! sprintf(scratch, "%s ill-formed", TIMEZONE);
logmessage(scratch);
strcpy(s, "TZ=");
return(s);
}
if (*p == delim) {
--- 1571,1582 ----
if ((*p == '"') || (*p == '\'')) {
/* it is quoted */
delim = *p++;
for (;;) {
if (*p == '\0') {
! /* etc/default/init ill-formed, go without TZ */
! sprintf(scratch, "%s ill-formed", TZFILE);
logmessage(scratch);
strcpy(s, "TZ=");
return(s);
}
if (*p == delim) {