Commit de7b37cd authored by Paolo 'Blaisorblade' Giarrusso's avatar Paolo 'Blaisorblade' Giarrusso Committed by Linus Torvalds

[PATCH] um: fix errno usage

Avoid reusing userspace errno twice - it can be cleared by libc code
everywhere (in particular printk() does clear it in my setup).
Signed-off-by: default avatarPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: default avatarJeff Dike <jdike@addtoit.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 0f97869d
......@@ -56,30 +56,31 @@ static int connect_to_switch(struct daemon_data *pri)
pri->control = socket(AF_UNIX, SOCK_STREAM, 0);
if(pri->control < 0){
err = -errno;
printk("daemon_open : control socket failed, errno = %d\n",
errno);
return(-errno);
-err);
return err;
}
if(connect(pri->control, (struct sockaddr *) ctl_addr,
sizeof(*ctl_addr)) < 0){
printk("daemon_open : control connect failed, errno = %d\n",
errno);
err = -errno;
printk("daemon_open : control connect failed, errno = %d\n",
-err);
goto out;
}
fd = socket(AF_UNIX, SOCK_DGRAM, 0);
if(fd < 0){
printk("daemon_open : data socket failed, errno = %d\n",
errno);
err = -errno;
printk("daemon_open : data socket failed, errno = %d\n",
-err);
goto out;
}
if(bind(fd, (struct sockaddr *) local_addr, sizeof(*local_addr)) < 0){
printk("daemon_open : data bind failed, errno = %d\n",
errno);
err = -errno;
printk("daemon_open : data bind failed, errno = %d\n",
-err);
goto out_close;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment