Skip to content

Commit

Permalink
fold into a single loop
Browse files Browse the repository at this point in the history
nearest equivalent to C style `while (n.admin != nil && !n.admin.Created) ;`
  • Loading branch information
klemensn committed Nov 3, 2024
1 parent e465bd6 commit 83c3563
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions cmd/yggdrasil/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,14 +284,9 @@ func main() {
// Change user if requested
if *chuserto != "" {
// Wait for other goroutines to finish potentially privileged tasks before dropping privileges.
if n.admin != nil {
for {
// control socket: UNIX requires filesystem permissions, TCP may use a low privileged port.
if n.admin.Created {
break
}
}
}
doWait := n.admin != nil
// control socket: UNIX requires filesystem permissions, TCP may use a low privileged port.
for ; doWait; doWait = !n.admin.Created {}

err = chuser(*chuserto)
if err != nil {
Expand Down

0 comments on commit 83c3563

Please sign in to comment.