Skip to content

Instantly share code, notes, and snippets.

@andrew-aladev
Created February 15, 2020 22:28
Show Gist options
  • Save andrew-aladev/ff07c2ce331fba96918b0a8af62f6afd to your computer and use it in GitHub Desktop.
Save andrew-aladev/ff07c2ce331fba96918b0a8af62f6afd to your computer and use it in GitHub Desktop.
buildah temp user directory
diff --git a/vendor/github.com/containers/storage/utils.go b/vendor/github.com/containers/storage/utils.go
index 28e0a8d..cc45d26 100644
--- a/vendor/github.com/containers/storage/utils.go
+++ b/vendor/github.com/containers/storage/utils.go
@@ -87,12 +87,11 @@ func getRootlessRuntimeDir(rootlessUID int) (string, error) {
if runtimeDir != "" {
return runtimeDir, nil
}
- tmpDir := fmt.Sprintf("/run/user/%d", rootlessUID)
+ tmpDir := fmt.Sprintf("%s/buildah-user-%d", os.TempDir(), rootlessUID)
st, err := system.Stat(tmpDir)
if err == nil && int(st.UID()) == os.Getuid() && st.Mode()&0700 == 0700 && st.Mode()&0066 == 0000 {
return tmpDir, nil
}
- tmpDir = fmt.Sprintf("%s/%d", os.TempDir(), rootlessUID)
if err := os.MkdirAll(tmpDir, 0700); err != nil {
logrus.Errorf("failed to create %s: %v", tmpDir, err)
} else {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment