summaryrefslogtreecommitdiff
path: root/net/iucv
diff options
context:
space:
mode:
authorHendrik Brueckner <brueckner@linux.vnet.ibm.com>2009-01-05 18:07:07 -0800
committerDavid S. Miller <davem@davemloft.net>2009-01-05 18:07:07 -0800
commit55cdea9ed9cf2d76993e40ed7a1fc649a14db07c (patch)
tree86a4fb463649731d88c6495fbd029f5751e578a2 /net/iucv
parent48e4cc777c091b037acaf39036a77ece43fe1ab9 (diff)
downloadlinux-3.10-55cdea9ed9cf2d76993e40ed7a1fc649a14db07c.tar.gz
linux-3.10-55cdea9ed9cf2d76993e40ed7a1fc649a14db07c.tar.bz2
linux-3.10-55cdea9ed9cf2d76993e40ed7a1fc649a14db07c.zip
af_iucv: New error return codes for connect()
If the iucv_path_connect() call fails then return an error code that corresponds to the iucv_path_connect() failure condition; instead of returning -ECONNREFUSED for any failure. This helps to improve error handling for user space applications (e.g. inform the user that the z/VM guest is not authorized to connect to other guest virtual machines). The error return codes are based on those described in connect(2). Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com> Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/iucv')
-rw-r--r--net/iucv/af_iucv.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
index af3192d2a5a..1077bc4e6e2 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -494,7 +494,21 @@ static int iucv_sock_connect(struct socket *sock, struct sockaddr *addr,
if (err) {
iucv_path_free(iucv->path);
iucv->path = NULL;
- err = -ECONNREFUSED;
+ switch (err) {
+ case 0x0b: /* Target communicator is not logged on */
+ err = -ENETUNREACH;
+ break;
+ case 0x0d: /* Max connections for this guest exceeded */
+ case 0x0e: /* Max connections for target guest exceeded */
+ err = -EAGAIN;
+ break;
+ case 0x0f: /* Missing IUCV authorization */
+ err = -EACCES;
+ break;
+ default:
+ err = -ECONNREFUSED;
+ break;
+ }
goto done;
}