blob: 05d85d4d8ded08288faba1a1db26a93c8f797c6f [file] [log] [blame]
// Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package suid
import (
"flag"
)
func Run(environ []string) error {
var work WorkParameters
if err := work.ProcessArguments(flag.CommandLine, environ); err != nil {
return err
}
if work.remove {
return work.Remove()
}
if work.kill {
return work.Kill()
}
if err := work.Chown(); err != nil {
return err
}
if work.chown {
// We were called with --chown, and Chown() was called above.
// There is nothing else to do.
return nil
}
return work.Exec()
}