Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-22883

Additional fix for ZBX-20604:UserParameterDir defined - crashes all userparameters on Windows

    XMLWordPrintable

Details

    • Team B
    • Sprint 101 (Jun 2023)
    • 0.25

    Description

      Fix needed for parent ZBX
      when the current directory if "C:\Windows\System32"

      diff --git a/src/go/pkg/zbxcmd/zbxcmd_windows.go b/src/go/pkg/zbxcmd/zbxcmd_windows.go
      index 48d6721994c..2fade9e62e3 100644
      --- a/src/go/pkg/zbxcmd/zbxcmd_windows.go
      +++ b/src/go/pkg/zbxcmd/zbxcmd_windows.go
      @@ -21,6 +21,7 @@ package zbxcmd
       
       import (
           "bytes"
      +    "errors"
           "fmt"
           "os/exec"
           "path/filepath"
      @@ -47,7 +48,7 @@ var (
       func execute(s string, timeout time.Duration, path string, strict bool) (out string, err error) {
           if cmd_path == "" {
               cmd_exe := "cmd.exe"
      -        if cmd_exe, err = exec.LookPath(cmd_exe); err != nil {
      +        if cmd_exe, err = exec.LookPath(cmd_exe); err != nil && !errors.Is(err, exec.ErrDot) {
                   return "", fmt.Errorf("Cannot find path to %s command: %s", cmd_exe, err)
               }
               if cmd_path, err = filepath.Abs(cmd_exe); err != nil {
      @@ -123,7 +124,7 @@ func execute(s string, timeout time.Duration, path string, strict bool) (out str
       func ExecuteBackground(s string) (err error) {
           if cmd_path == "" {
               cmd_exe := "cmd.exe"
      -        if cmd_exe, err = exec.LookPath(cmd_exe); err != nil {
      +        if cmd_exe, err = exec.LookPath(cmd_exe); err != nil && !errors.Is(err, exec.ErrDot) {
                   return fmt.Errorf("Cannot find path to %s command: %s", cmd_exe, err)
               }
               if cmd_path, err = filepath.Abs(cmd_exe); err != nil {
       

      Attachments

        Issue Links

          Activity

            People

              MVekslers Michael Veksler
              MVekslers Michael Veksler
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: