store: Deal with unsupported `setsockopt' operation on GNU/Hurd.

* guix/store.scm (open-connection): Silently ignore ENOPROTOOPT on
  `setsockopt' calls, for the sake of GNU/Hurd.
  Reported by Matthew Lien <bluet@bluet.org> at
  <http://lists.gnu.org/archive/html/bug-guix/2013-07/msg00020.html>.
master
Ludovic Courtès 2013-07-04 22:49:00 +02:00
parent 5363abb776
commit 8c95b27ce6
1 changed files with 9 additions and 2 deletions

View File

@ -266,8 +266,15 @@ operate, should the disk become full. Return a server object."
(socket PF_UNIX SOCK_STREAM 0)))
(a (make-socket-address PF_UNIX file)))
;; Enlarge the receive buffer.
(setsockopt s SOL_SOCKET SO_RCVBUF (* 12 1024))
(catch 'system-error
(lambda ()
;; Enlarge the receive buffer.
(setsockopt s SOL_SOCKET SO_RCVBUF (* 12 1024)))
(lambda args
;; On the Hurd, the pflocal server's implementation of `socket_setopt'
;; always returns ENOPROTOOPT. Ignore it.
(unless (= (system-error-errno args) ENOPROTOOPT)
(apply throw args))))
(catch 'system-error
(cut connect s a)