mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
23 lines
411 B
Go
23 lines
411 B
Go
|
// +build !darwin
|
||
|
|
||
|
package dbus
|
||
|
|
||
|
import (
|
||
|
"io"
|
||
|
"os"
|
||
|
"syscall"
|
||
|
)
|
||
|
|
||
|
func (t *unixTransport) SendNullByte() error {
|
||
|
ucred := &syscall.Ucred{Pid: int32(os.Getpid()), Uid: uint32(os.Getuid()), Gid: uint32(os.Getgid())}
|
||
|
b := syscall.UnixCredentials(ucred)
|
||
|
_, oobn, err := t.UnixConn.WriteMsgUnix([]byte{0}, b, nil)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
if oobn != len(b) {
|
||
|
return io.ErrShortWrite
|
||
|
}
|
||
|
return nil
|
||
|
}
|