Skip to content

Commit

Permalink
facebookarchive#44 unset LISTEN_FDS since it isn’t needed
Browse files Browse the repository at this point in the history
  • Loading branch information
waterdrink authored and wangyue committed Dec 12, 2018
1 parent 75cf193 commit b72c975
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions gracenet/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ func (n *Net) inherit() error {
if countStr == "" {
return
}
defer func() {
os.Unsetenv(envCountKey)
}()
count, err := strconv.Atoi(countStr)
if err != nil {
retErr = fmt.Errorf("found invalid count value: %s=%s", envCountKey, countStr)
Expand Down

2 comments on commit b72c975

@daaku
Copy link

@daaku daaku commented on b72c975 Dec 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it in a defer?

@waterdrink
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@daaku
I assume inherit() use LISTEN_FDS util it finish, so unset LISTEN_FDS when it finish make sense to me.
But Yes, you are right, just add os.Unsetenv(envCountKey) in line 52 is ok.

Please sign in to comment.