From 8b24ad83a8fef5cb5e81089f6699542f95820dc8 Mon Sep 17 00:00:00 2001 From: Christian Svensson Date: Sun, 16 Aug 2020 20:45:25 +0200 Subject: [PATCH] Document why we pad blanks --- unix/syscall_linux.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/unix/syscall_linux.go b/unix/syscall_linux.go index f66c515b..2226e637 100644 --- a/unix/syscall_linux.go +++ b/unix/syscall_linux.go @@ -894,6 +894,9 @@ type SockaddrIUCV struct { func (sa *SockaddrIUCV) sockaddr() (unsafe.Pointer, _Socklen, error) { sa.raw.Family = AF_IUCV + // These are EBCDIC encoded by the kernel, but we still need to pad them + // with blanks. Initializing with blanks allows the caller to feed in either + // a padded or an unpadded string. for i := 0; i < 8; i++ { sa.raw.Nodeid[i] = ' ' sa.raw.User_id[i] = ' '