aboutsummaryrefslogtreecommitdiffhomepage
path: root/ldd/ldd.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2024-12-26 16:53:01 +0900
committerOphestra <cat@gensokyo.uk>2024-12-26 16:53:01 +0900
commitb956ce405219993ab4d881cf4a671ecd510f8548 (patch)
tree367adcec3bf1ecc32909ed9f83a6e42d4ccc9c0f /ldd/ldd.go
parentdc579dc610e484e40b57951e8f82580c8b711eca (diff)
ldd: trim leading and trailing white spaces from name
Glibc emits ldd output with \t prefix for formatting. Remove that here. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'ldd/ldd.go')
-rw-r--r--ldd/ldd.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/ldd/ldd.go b/ldd/ldd.go
index 2862dab3..434fbab6 100644
--- a/ldd/ldd.go
+++ b/ldd/ldd.go
@@ -32,7 +32,7 @@ func Parse(stdout fmt.Stringer) ([]*Entry, error) {
switch len(segment) {
case 2: // /lib/ld-musl-x86_64.so.1 (0x7f04d14ef000)
iL = 1
- result[i] = &Entry{Name: segment[0]}
+ result[i] = &Entry{Name: strings.TrimSpace(segment[0])}
case 4: // libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x7f04d14ef000)
iL = 3
if segment[1] != "=>" {
@@ -42,7 +42,7 @@ func Parse(stdout fmt.Stringer) ([]*Entry, error) {
return nil, ErrPathNotAbsolute
}
result[i] = &Entry{
- Name: segment[0],
+ Name: strings.TrimSpace(segment[0]),
Path: segment[2],
}
default: