summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2015-10-26 15:31:23 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-10-26 15:31:23 -0400
commit67d1b8d2cc51e0968cf0eba17408520c6ebea644 (patch)
tree0e9be55196e523b9ccb2fd55f77c4dc9b72bd711 /src
parente04cc063d12dafe19317a8a22e94e0a52989e9e9 (diff)
dl: fix a pointer/value issue found by go vet
Diffstat (limited to 'src')
-rw-r--r--src/dl/dlfcn.go10
-rw-r--r--src/dl/dlsym_reserved.go4
2 files changed, 7 insertions, 7 deletions
diff --git a/src/dl/dlfcn.go b/src/dl/dlfcn.go
index db8bd63..f182cfe 100644
--- a/src/dl/dlfcn.go
+++ b/src/dl/dlfcn.go
@@ -66,7 +66,7 @@ type Handle struct {
// symbol table for the current process; if the name contains a slash,
// then it is interpretted as a pathname; otherwise, it is
// interpretted in an implementation-defined manner.
-func Open(name string, flags Flag) (Handle, error) {
+func Open(name string, flags Flag) (*Handle, error) {
nameC := C.CString(name)
defer C.free(unsafe.Pointer(nameC))
if name == "" {
@@ -76,9 +76,9 @@ func Open(name string, flags Flag) (Handle, error) {
dlerror()
ptr := C.dlopen(nameC, C.int(flags))
if ptr == nil {
- return Handle{}, dlerror()
+ return &Handle{}, dlerror()
}
- return Handle{c: ptr, o: 1}, nil
+ return &Handle{c: ptr, o: 1}, nil
}
// Look up a symbol, and return a pointer to it.
@@ -86,7 +86,7 @@ func Open(name string, flags Flag) (Handle, error) {
// This returns uintptr instead of unsafe.Pointer so that code using
// dl cannot obtain unsafe.Pointers without importing the unsafe
// package explicitly.
-func (h Handle) Sym(symbol string) (uintptr, error) {
+func (h *Handle) Sym(symbol string) (uintptr, error) {
h.l.RLock()
defer h.l.RUnlock()
@@ -108,7 +108,7 @@ func (h Handle) Sym(symbol string) (uintptr, error) {
// Close this handle on a shared object; decrementint the reference
// count; if the reference count drops below 0, then the object is
// unloaded.
-func (h Handle) Close() error {
+func (h *Handle) Close() error {
h.l.Lock()
defer h.l.Unlock()
diff --git a/src/dl/dlsym_reserved.go b/src/dl/dlsym_reserved.go
index 081e012..e4f9eec 100644
--- a/src/dl/dlsym_reserved.go
+++ b/src/dl/dlsym_reserved.go
@@ -58,6 +58,6 @@ var (
)
func init() {
- RTLD_DEFAULT = Handle{c: unsafe.Pointer(uintptr(C.rtld_default)), o: 2}
- RTLD_DEFAULT = Handle{c: unsafe.Pointer(uintptr(C.rtld_next)), o: 2}
+ RTLD_DEFAULT = &Handle{c: unsafe.Pointer(uintptr(C.rtld_default)), o: 2}
+ RTLD_DEFAULT = &Handle{c: unsafe.Pointer(uintptr(C.rtld_next)), o: 2}
}