Add more information in the error messages when writing to a file
This is helpful to debug "invalid argument" errors when writing to cgroup files Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
This commit is contained in:
parent
69fe79de10
commit
35541ebcd2
|
@ -351,7 +351,10 @@ func writeFile(dir, file, data string) error {
|
|||
if dir == "" {
|
||||
return fmt.Errorf("no such directory for %s.", file)
|
||||
}
|
||||
return ioutil.WriteFile(filepath.Join(dir, file), []byte(data), 0700)
|
||||
if err := ioutil.WriteFile(filepath.Join(dir, file), []byte(data), 0700); err != nil {
|
||||
return fmt.Errorf("failed to write %v to %v: %v", data, file, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func readFile(dir, file string) (string, error) {
|
||||
|
|
Loading…
Reference in New Issue