New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
syscall: errno handling for write call may inappropriate #26907
Comments
We don't use the issue tracker for questions. Please see https://golang.org/wiki/Questions . Thanks. In reading the man page, you are confusing the behavior of the C library function Closing because there is no action to take. |
Hi @ianlancetaylor, thanks for your clarification. I think this issue points to the difference between C According to the man page, the 0 return is clearly defined in C Indeed Go directly wraps system call func writeAll(fd int, buffer []byte) bool {
length := len(buffer)
for length > 0 {
written, err := syscall.Write(fd, buffer)
if err != nil { // here
return false
}
length -= written
buffer = buffer[written:]
}
return true
} |
If you are speculating, please use a forum; see https://golang.org/wiki/Questions . If you are reporting a bug, please include a complete test program that we can use to reproduce the problem. Thanks. |
syscall
write
returns -1 and seterrno
is a trivial case. I am interested in the status oferrno
ifwrite
call returning zero or positive. The wrapper of Go simply returnserr
iferrno
is not zero, which also includes the case ofwrite
call returns positive.go/src/syscall/zsyscall_linux_386.go
Line 1007 in 3cb64ea
However, the man page of
write
call roughly describeserrno
may also be set but unspecified if returns zero without explaining any detail.Thus, the following cases seem unclear:
errno
ifwrite
call returning 0?write
call returning 0 anderrno
is not 0?errno
ifwrite
call returning positive?The text was updated successfully, but these errors were encountered: