config/path: Figure out absolute paths properly on windows. (#3996)

The following form of arguments such as

```
minio.exe -C some_dir server dir
```

has stopped working because of lack of handling of
absolute paths for config directory. Always calculate
absolute path for any relative paths on any operating
system.

The following fix converts all config directory relative
paths into absolute paths.

Fixes #3991
master
Harshavardhana 8 years ago committed by GitHub
parent d99efa2c93
commit 1caad902cb
  1. 9
      cmd/server-main.go

@ -23,6 +23,7 @@ import (
"net/url" "net/url"
"os" "os"
"path" "path"
"path/filepath"
"sort" "sort"
"strconv" "strconv"
"strings" "strings"
@ -482,6 +483,14 @@ func serverMain(c *cli.Context) {
fatalIf(errors.New("empty directory"), "Configuration directory cannot be empty.") fatalIf(errors.New("empty directory"), "Configuration directory cannot be empty.")
} }
// Disallow relative paths, figure out absolute paths.
{
configDirAbs, err := filepath.Abs(configDir)
fatalIf(err, "Unable to fetch absolute path for config directory %s", configDir)
configDir = configDirAbs
}
// Set configuration directory. // Set configuration directory.
setConfigDir(configDir) setConfigDir(configDir)

Loading…
Cancel
Save