Skip to content

Commit 5e92644

Browse files
Merge pull request #1169 from n1hility/win-regression
Fix Windows regression introduced by PR #1161
2 parents dd3cdd9 + be3c3b0 commit 5e92644

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

pkg/config/default.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func DefaultConfig() (*Config, error) {
180180
}
181181

182182
defaultEngineConfig.SignaturePolicyPath = DefaultSignaturePolicyPath
183-
if unshare.GetRootlessUID() > 0 {
183+
if useUserConfigLocations() {
184184
configHome, err := homedir.GetConfigHome()
185185
if err != nil {
186186
return nil, err
@@ -289,7 +289,7 @@ func defaultConfigFromMemory() (*EngineConfig, error) {
289289
return nil, err
290290
}
291291
}
292-
storeOpts, err := types.DefaultStoreOptions(unshare.GetRootlessUID() > 0, unshare.GetRootlessUID())
292+
storeOpts, err := types.DefaultStoreOptions(useUserConfigLocations(), unshare.GetRootlessUID())
293293
if err != nil {
294294
return nil, err
295295
}
@@ -427,7 +427,7 @@ func defaultConfigFromMemory() (*EngineConfig, error) {
427427
}
428428

429429
func defaultTmpDir() (string, error) {
430-
if unshare.GetRootlessUID() == 0 {
430+
if !useUserConfigLocations() {
431431
return getLibpodTmpDir(), nil
432432
}
433433

@@ -679,3 +679,10 @@ func getDefaultSSHConfig() string {
679679
dirname := homedir.Get()
680680
return filepath.Join(dirname, ".ssh", "config")
681681
}
682+
683+
func useUserConfigLocations() bool {
684+
// NOTE: For now we want Windows to use system locations.
685+
// GetRootlessUID == -1 on Windows, so exclude negative range
686+
return unshare.GetRootlessUID() > 0
687+
}
688+

0 commit comments

Comments
 (0)