Skip to content

Commit

Permalink
make make sure non-windows options do not crash windows binary
Browse files Browse the repository at this point in the history
  • Loading branch information
korc committed Jun 18, 2023
1 parent 9a09aba commit e9b0c1b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func main() {
}

var switchToUser *user.User
if *userName != "" {
if userName != nil && *userName != "" {
var err error
logf(nil, logLevelWarning, "Switch to user is discouraged, cf. https://github.com/golang/go/issues/1435")
if switchToUser, err = user.Lookup(*userName); err != nil {
Expand Down Expand Up @@ -250,7 +250,7 @@ func main() {
} else {
logf(nil, logLevelWarning, "SSL not enabled")
}
if *chroot != "" {
if chroot != nil && *chroot != "" {
if err := os.Chdir(*chroot); err != nil {
logf(nil, logLevelFatal, "Cannot chdir to %#v: %v", *chroot, err)
}
Expand Down

0 comments on commit e9b0c1b

Please sign in to comment.