diff options
| author | Grégoire Duchêne <gduchene@awhk.org> | 2021-07-04 15:46:25 +0100 |
|---|---|---|
| committer | Grégoire Duchêne <gduchene@awhk.org> | 2021-07-04 15:46:25 +0100 |
| commit | baf535676025303f4e713fdf9f45d2d5a024cf6c (patch) | |
| tree | 341996962ef4a9d63c0814a5823dd90c923ff316 | |
| parent | e906e039337f290b1965a5c6e68e1ea3f4c0c89d (diff) | |
Use syscall.Errno to wrap C error codes
| -rw-r--r-- | socket_linux.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/socket_linux.go b/socket_linux.go index 6616d04..cab9701 100644 --- a/socket_linux.go +++ b/socket_linux.go @@ -12,8 +12,8 @@ package gosdd import "C" import ( - "fmt" "os" + "syscall" "unsafe" ) @@ -24,7 +24,7 @@ func sdListenFDs(unsetenv bool) ([]*os.File, error) { } c := C.sd_listen_fds(i) if c < 0 { - return nil, fmt.Errorf("sd_listen_fds: %s", C.GoString(C.strerror(-c))) + return nil, syscall.Errno(-c) } if c == 0 { return nil, nil @@ -44,7 +44,7 @@ func sdListenFDsWithNames(unsetenv bool) (map[string]*os.File, error) { var arr **C.char c := C.sd_listen_fds_with_names(i, &arr) if c < 0 { - return nil, fmt.Errorf("sd_listen_fds_with_names: %s", C.GoString(C.strerror(-c))) + return nil, syscall.Errno(-c) } if c == 0 { return nil, nil |
