From 9ed6d59151bc5fdb285e83f6e45fe6d8ef5ce9eb Mon Sep 17 00:00:00 2001 From: Matthias Rampke Date: Tue, 9 Apr 2019 11:13:33 -0700 Subject: [PATCH] Correct to use name socket mode instead of mask Co-Authored-By: fffonion Signed-off-by: Wangchong Zhou --- main.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index 2f4af3f..30e4db3 100644 --- a/main.go +++ b/main.go @@ -143,10 +143,10 @@ func main() { statsdListenTCP = kingpin.Flag("statsd.listen-tcp", "The TCP address on which to receive statsd metric lines. \"\" disables it.").Default(":9125").String() statsdListenUnixgram = kingpin.Flag("statsd.listen-unixgram", "The Unixgram socket path to receive statsd metric lines in datagram. \"\" disables it.").Default("").String() // not using Int here because flag diplays default in decimal, 0755 will show as 493 - statsdUnixSocketUmask = kingpin.Flag("statsd.unixsocket-umask", "The umask of the unix socket.").Default("755").String() - mappingConfig = kingpin.Flag("statsd.mapping-config", "Metric mapping configuration file name.").String() - readBuffer = kingpin.Flag("statsd.read-buffer", "Size (in bytes) of the operating system's transmit read buffer associated with the UDP or Unixgram connection. Please make sure the kernel parameters net.core.rmem_max is set to a value greater than the value specified.").Int() - dumpFSMPath = kingpin.Flag("debug.dump-fsm", "The path to dump internal FSM generated for glob matching as Dot file.").Default("").String() + statsdUnixSocketMode = kingpin.Flag("statsd.unixsocket-mode", "The permission mode of the unix socket.").Default("755").String() + mappingConfig = kingpin.Flag("statsd.mapping-config", "Metric mapping configuration file name.").String() + readBuffer = kingpin.Flag("statsd.read-buffer", "Size (in bytes) of the operating system's transmit read buffer associated with the UDP or Unixgram connection. Please make sure the kernel parameters net.core.rmem_max is set to a value greater than the value specified.").Int() + dumpFSMPath = kingpin.Flag("debug.dump-fsm", "The path to dump internal FSM generated for glob matching as Dot file.").Default("").String() ) log.AddFlags(kingpin.CommandLine) @@ -226,9 +226,9 @@ func main() { // so we can't chmod it either if _, err := os.Stat(*statsdListenUnixgram); !os.IsNotExist(err) { // convert the string to octet - perm, err := strconv.ParseInt("0"+string(*statsdUnixSocketUmask), 8, 32) + perm, err := strconv.ParseInt("0"+string(*statsdUnixSocketMode), 8, 32) if err != nil { - log.Warnf("Bad permission %s: %v, ignoring\n", *statsdUnixSocketUmask, err) + log.Warnf("Bad permission %s: %v, ignoring\n", *statsdUnixSocketMode, err) } else { err = os.Chmod(*statsdListenUnixgram, os.FileMode(perm)) if err != nil {