Correct to use name socket mode instead of mask

Co-Authored-By: fffonion <fffonion@gmail.com>
Signed-off-by: Wangchong Zhou <fffonion@gmail.com>
This commit is contained in:
Matthias Rampke 2019-04-09 11:13:33 -07:00 committed by Wangchong Zhou
parent 05bca84294
commit 9ed6d59151
No known key found for this signature in database
GPG key ID: B607274584E8D5E5

View file

@ -143,7 +143,7 @@ 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()
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()
@ -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 {