From 3269bc539e52cdced8c03a628e4fdf22942ece4b Mon Sep 17 00:00:00 2001 From: Joseph Richey Date: Thu, 19 Oct 2017 03:37:54 -0700 Subject: util: Add CheckIfRoot Replace IsUserRoot with CheckIfRoot. This allows all functions to use the same error handling when a user is not root. --- cmd/fscrypt/setup.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cmd/fscrypt/setup.go') diff --git a/cmd/fscrypt/setup.go b/cmd/fscrypt/setup.go index 72dfbdb..ac32484 100644 --- a/cmd/fscrypt/setup.go +++ b/cmd/fscrypt/setup.go @@ -31,8 +31,8 @@ import ( // createGlobalConfig creates (or overwrites) the global config file func createGlobalConfig(w io.Writer, path string) error { - if !util.IsUserRoot() { - return ErrMustBeRoot + if err := util.CheckIfRoot(); err != nil { + return err } // Ask to create or replace the config file -- cgit v1.2.3