forked from luck/tmp_suning_uos_patched
[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: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Acked-by: Jeff Dike <jdike@addtoit.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
0f97869df6
commit
de7b37cd01
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user