check return value of syscall.Chdir when changing working directory

This commit is contained in:
Yang Bai 2013-10-14 15:27:38 +08:00
parent 620bc5b9e1
commit 1043055b10
2 changed files with 4 additions and 1 deletions

View File

@ -185,4 +185,5 @@ Vladimir Kirillov <proger@wilab.org.ua>
Walter Stanish <walter@pratyeka.org>
Wes Morgan <cap10morgan@gmail.com>
Will Dietz <w@wdtz.org>
Yang Bai <hamo.by@gmail.com>
Zaiste! <oh@zaiste.net>

View File

@ -27,7 +27,9 @@ func setupWorkingDirectory(workdir string) {
if workdir == "" {
return
}
syscall.Chdir(workdir)
if err := syscall.Chdir(workdir); err != nil {
log.Fatalf("Unable to change dir to %v: %v", workdir, err)
}
}
// Takes care of dropping privileges to the desired user