mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Force timezone initialization before filter installation
The first use of time.Local (usually via time.Time.Date, et. al) performs initialization of the local timezone, which involves open several tzdata files from the host. Since filter installation disallows open, we should explicitly force this initialization rather than implicitly depending on the first logging (or other time) call occurring before filter installation. PiperOrigin-RevId: 282053121
This commit is contained in:
committed by
gVisor bot
parent
8eb68912e4
commit
5eb522193c
@@ -26,6 +26,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"flag"
|
||||
|
||||
@@ -237,6 +238,18 @@ func main() {
|
||||
log.SetLevel(log.Debug)
|
||||
}
|
||||
|
||||
// Logging will include the local date and time via the time package.
|
||||
//
|
||||
// On first use, time.Local initializes the local time zone, which
|
||||
// involves opening tzdata files on the host. Since this requires
|
||||
// opening host files, it must be done before syscall filter
|
||||
// installation.
|
||||
//
|
||||
// Generally there will be a log message before filter installation
|
||||
// that will force initialization, but force initialization here in
|
||||
// case that does not occur.
|
||||
_ = time.Local.String()
|
||||
|
||||
subcommand := flag.CommandLine.Arg(0)
|
||||
|
||||
var e log.Emitter
|
||||
|
||||
Reference in New Issue
Block a user