[php-fpm] Fix possible "index out of range" (#8461)
This commit is contained in:
parent
8b30bb9534
commit
832925d9c8
|
|
@ -7,7 +7,6 @@ import (
|
|||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
|
|
@ -301,25 +300,18 @@ func globUnixSocket(url string) ([]string, error) {
|
|||
}
|
||||
paths := glob.Match()
|
||||
if len(paths) == 0 {
|
||||
if _, err := os.Stat(paths[0]); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return nil, fmt.Errorf("Socket doesn't exist '%s': %s", pattern, err)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
return nil, nil
|
||||
return nil, fmt.Errorf("socket doesn't exist %q: %v", pattern, err)
|
||||
}
|
||||
|
||||
addrs := make([]string, 0, len(paths))
|
||||
|
||||
addresses := make([]string, 0, len(paths))
|
||||
for _, path := range paths {
|
||||
if status != "" {
|
||||
path = path + ":" + status
|
||||
}
|
||||
addrs = append(addrs, path)
|
||||
addresses = append(addresses, path)
|
||||
}
|
||||
|
||||
return addrs, nil
|
||||
return addresses, nil
|
||||
}
|
||||
|
||||
func unixSocketPaths(addr string) (string, string) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue