Commit 3813f941 authored by Ian Lance Taylor's avatar Ian Lance Taylor

internal/poll: always decref if setting deadline fails

No test because at present it is never called in a way that fails.
When #22114 is implemented, failure will be possible. Not including this
change in that work because this change is separable and clearly correct.

Updates #22114

Change-Id: I81eb9eec8800e8082d918c0e5fb71282f538267e
Reviewed-on: https://go-review.googlesource.com/71751
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: 's avatarJoe Tsai <joetsai@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 7b9d15d5
......@@ -147,11 +147,11 @@ func setDeadlineImpl(fd *FD, t time.Time, mode int) error {
if err := fd.incref(); err != nil {
return err
}
defer fd.decref()
if fd.pd.runtimeCtx == 0 {
return errors.New("file type does not support deadlines")
}
runtime_pollSetDeadline(fd.pd.runtimeCtx, d, mode)
fd.decref()
return nil
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment