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