summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/build.go3
-rw-r--r--cmd/podman/main.go16
-rw-r--r--pkg/util/utils_supported.go4
3 files changed, 13 insertions, 10 deletions
diff --git a/cmd/podman/build.go b/cmd/podman/build.go
index 12aedac37..fa4689211 100644
--- a/cmd/podman/build.go
+++ b/cmd/podman/build.go
@@ -53,13 +53,12 @@ var (
}
)
-func init() {
+func initBuild() {
buildCommand.Command = _buildCommand
buildCommand.SetHelpTemplate(HelpTemplate())
buildCommand.SetUsageTemplate(UsageTemplate())
flags := buildCommand.Flags()
flags.SetInterspersed(true)
-
budFlags := buildahcli.GetBudFlags(&budFlagsValues)
flag := budFlags.Lookup("pull")
if err := flag.Value.Set("true"); err != nil {
diff --git a/cmd/podman/main.go b/cmd/podman/main.go
index a22b01f24..3320ab72f 100644
--- a/cmd/podman/main.go
+++ b/cmd/podman/main.go
@@ -83,7 +83,7 @@ var rootCmd = &cobra.Command{
var MainGlobalOpts cliconfig.MainFlags
-func init() {
+func initCobra() {
cobra.OnInitialize(initConfig)
rootCmd.TraverseChildren = true
rootCmd.Version = version.Version
@@ -94,16 +94,20 @@ func init() {
rootCmd.AddCommand(getMainCommands()...)
}
-func initConfig() {
- // we can do more stuff in here.
-}
-
-func before(cmd *cobra.Command, args []string) error {
+func init() {
if err := libpod.SetXdgDirs(); err != nil {
logrus.Errorf(err.Error())
os.Exit(1)
}
+ initBuild()
+ initCobra()
+}
+
+func initConfig() {
+ // we can do more stuff in here.
+}
+func before(cmd *cobra.Command, args []string) error {
// Set log level; if not log-level is provided, default to error
logLevel := MainGlobalOpts.LogLevel
if logLevel == "" {
diff --git a/pkg/util/utils_supported.go b/pkg/util/utils_supported.go
index 0b78a8150..c6aed9943 100644
--- a/pkg/util/utils_supported.go
+++ b/pkg/util/utils_supported.go
@@ -33,7 +33,7 @@ func GetRuntimeDir() (string, error) {
logrus.Debugf("unable to make temp dir %s", tmpDir)
}
st, err := os.Stat(tmpDir)
- if err == nil && int(st.Sys().(*syscall.Stat_t).Uid) == os.Geteuid() && st.Mode().Perm() == 0700 {
+ if err == nil && int(st.Sys().(*syscall.Stat_t).Uid) == os.Geteuid() && (st.Mode().Perm()&0700 == 0700) {
runtimeDir = tmpDir
}
}
@@ -43,7 +43,7 @@ func GetRuntimeDir() (string, error) {
logrus.Debugf("unable to make temp dir %s", tmpDir)
}
st, err := os.Stat(tmpDir)
- if err == nil && int(st.Sys().(*syscall.Stat_t).Uid) == os.Geteuid() && st.Mode().Perm() == 0700 {
+ if err == nil && int(st.Sys().(*syscall.Stat_t).Uid) == os.Geteuid() && (st.Mode().Perm()&0700 == 0700) {
runtimeDir = tmpDir
}
}