summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-03-25 17:24:47 +0100
committerLudovic Courtès <ludo@gnu.org>2016-03-25 17:24:47 +0100
commit001dae0d7431719655f525a94dc900cc078cca99 (patch)
treef661946879cafc1df0d4ee8b84eb64501f6c2030
parenta2da8c173a022bd90168c0fe90b2c59ce76d24f8 (diff)
downloadpatches-001dae0d7431719655f525a94dc900cc078cca99.tar
patches-001dae0d7431719655f525a94dc900cc078cca99.tar.gz
syscalls: <interface> printer correctly handles lack of sockaddr.
Reported by Danny Milosavljevic <dannym@scratchpost.org> in <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22612#16>. * guix/build/syscalls.scm (write-interface): Check whether ADDRESS is true.
-rw-r--r--guix/build/syscalls.scm12
1 files changed, 8 insertions, 4 deletions
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index ea68b22bb7..69a507def8 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -767,10 +767,14 @@ the same type as that returned by 'make-socket-address'."
(format port "#<interface ~s " name)
(unless (zero? (logand IFF_UP flags))
(display "up " port))
- (if (member (sockaddr:fam address) (list AF_INET AF_INET6))
- (format port "~a " (inet-ntop (sockaddr:fam address)
- (sockaddr:addr address)))
- (format port "family:~a " (sockaddr:fam address)))
+
+ ;; Check whether ADDRESS really is a sockaddr.
+ (when address
+ (if (member (sockaddr:fam address) (list AF_INET AF_INET6))
+ (format port "~a " (inet-ntop (sockaddr:fam address)
+ (sockaddr:addr address)))
+ (format port "family:~a " (sockaddr:fam address))))
+
(format port "~a>" (number->string (object-address interface) 16)))))
(set-record-type-printer! <interface> write-interface)