LEFT | RIGHT |
(Both sides are equal) |
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // Socket control messages | 5 // Socket control messages |
6 | 6 |
7 package syscall | 7 package syscall |
8 | 8 |
9 import "unsafe" | 9 import "unsafe" |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 func ParseUnixCredentials(m *SocketControlMessage) (*Ucred, error) { | 27 func ParseUnixCredentials(m *SocketControlMessage) (*Ucred, error) { |
28 if m.Header.Level != SOL_SOCKET { | 28 if m.Header.Level != SOL_SOCKET { |
29 return nil, EINVAL | 29 return nil, EINVAL |
30 } | 30 } |
31 if m.Header.Type != SCM_CREDENTIALS { | 31 if m.Header.Type != SCM_CREDENTIALS { |
32 return nil, EINVAL | 32 return nil, EINVAL |
33 } | 33 } |
34 ucred := *(*Ucred)(unsafe.Pointer(&m.Data[0])) | 34 ucred := *(*Ucred)(unsafe.Pointer(&m.Data[0])) |
35 return &ucred, nil | 35 return &ucred, nil |
36 } | 36 } |
LEFT | RIGHT |