Browse Source

Use a define for the path to /etc/TZ

David McCullough 21 years ago
parent
commit
5433dd6660
2 changed files with 3 additions and 1 deletions
  1. 1 0
      include/paths.h
  2. 2 1
      libc/misc/time/time.c

+ 1 - 0
include/paths.h

@@ -67,6 +67,7 @@
 #define	_PATH_SHADOW	"/etc/shadow"
 #define	_PATH_PASSWD	"/etc/passwd"
 #define	_PATH_GROUP	"/etc/group"
+#define	_PATH_TZ	"/etc/TZ"
 
 /* Provide trailing slash, since mostly used for building pathnames. */
 #define	_PATH_DEV	"/dev/"

+ 2 - 1
libc/misc/time/time.c

@@ -136,6 +136,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include "paths.h"
 /* ":<tzname>+hh:mm:ss<tzname>+hh:mm:ss,Mmm.w.d/hh:mm:ss,Mmm.w.d/hh:mm:ss" + nul */
 /* 1 + 2*(1+TZNAME_MAX+1 + 9 + 7 + 9) + 1 = 2*TZNAME_MAX + 56 */
 #else  /* __TIME_TZ_FILE */
@@ -1537,7 +1538,7 @@ static char *read_TZ_file(char *buf)
 	size_t todo;
 	char *p = NULL;
 
-	if ((fd = open("/etc/TZ", O_RDONLY)) >= 0) {
+	if ((fd = open(_PATH_TZ, O_RDONLY)) >= 0) {
 		todo = TZ_BUFLEN;
 		p = buf;
 		do {