From: Cyprien Nicolas <cyprien@nicolas.tf>
To: guix-devel@gnu.org
Subject: dmd: [PATCH] Improve socket connection errors handling.
Date: Thu, 10 Apr 2014 10:14:46 +0200 [thread overview]
Message-ID: <20140410081446.GF9248@kubera.prv.maison> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 284 bytes --]
My first patch for dmd :-)
I thought about moving the interior format call to support.scm
(caught-error), but I wanted to keep the patch simple, and not making
two differents changes in one patch (error handling, support
improvements).
Comments welcome.
--
Cyprien/Fulax
[-- Attachment #1.2: 0001-Improve-socket-connection-errors-handling.patch --]
[-- Type: text/x-diff, Size: 1395 bytes --]
From 6e8f871198b661b631a319f3abaef71bc6269fb7 Mon Sep 17 00:00:00 2001
From: Cyprien Nicolas <cyp@fulax.fr>
Date: Thu, 10 Apr 2014 10:07:06 +0200
Subject: [PATCH] Improve socket connection errors handling.
If the user running `deco' does not have the rights privileges to open
the unix socket, the raised exception produces a backtrace.
* modules/dmd/comm.scm (open-connection): Add a (catch
'system-error...) guard around the connect function call.
The handler will abort the program in case of error.
---
modules/dmd/comm.scm | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/modules/dmd/comm.scm b/modules/dmd/comm.scm
index d3743e6..4a0d383 100644
--- a/modules/dmd/comm.scm
+++ b/modules/dmd/comm.scm
@@ -63,7 +63,14 @@ return the socket."
(with-fluids ((%default-port-encoding "UTF-8"))
(let ((sock (socket PF_UNIX SOCK_STREAM 0))
(address (make-socket-address PF_UNIX file)))
- (connect sock address)
+ (catch 'system-error
+ (lambda ()
+ (connect sock address))
+ (lambda (key . args)
+ (display (format #f "Error: Cannot connect to socket `~a': ~a\n"
+ file (apply format #f (cadr args) (caddr args)))
+ (current-error-port))
+ (quit 1)))
sock)))
(define (read-command port)
--
1.8.5.4
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
next reply other threads:[~2014-04-10 8:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-10 8:14 Cyprien Nicolas [this message]
2014-04-10 14:52 ` dmd: [PATCH] Improve socket connection errors handling Ludovic Courtès
2014-04-10 15:16 ` Cyprien Nicolas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140410081446.GF9248@kubera.prv.maison \
--to=cyprien@nicolas.tf \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.