UNIX socket creation - Don't chmod if mode not set

This commit is contained in:
Emmanuel BENOîT 2021-10-31 09:12:26 +01:00
parent 610cbf28f8
commit e6aaa09795

View file

@ -24,9 +24,11 @@ func configureSocket(cfg tSocketConfig) error {
}
}
err := os.Chmod(cfg.Path, cfg.Mode)
if err != nil {
return fmt.Errorf("Cannot set UNIX socket access mode: %w", err)
if cfg.Mode != 0 {
err := os.Chmod(cfg.Path, cfg.Mode)
if err != nil {
return fmt.Errorf("Cannot set UNIX socket access mode: %w", err)
}
}
return nil