diff options
author | Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> | 2007-03-07 23:41:14 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-03-08 10:38:21 -0500 |
commit | de7b37cd01f145dd3a3ca333fd631e58ec0bdbab (patch) | |
tree | 97df058239eb286a649660f110faaa8924f7c9db /arch/um/drivers/daemon_user.c | |
parent | 0f97869df672f7f05ce3e8672ca42792d6df852b (diff) |
[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>
Diffstat (limited to 'arch/um/drivers/daemon_user.c')
-rw-r--r-- | arch/um/drivers/daemon_user.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/arch/um/drivers/daemon_user.c b/arch/um/drivers/daemon_user.c index 310af0f1e49e..021b82c7a759 100644 --- a/arch/um/drivers/daemon_user.c +++ b/arch/um/drivers/daemon_user.c | |||
@@ -56,30 +56,31 @@ static int connect_to_switch(struct daemon_data *pri) | |||
56 | 56 | ||
57 | pri->control = socket(AF_UNIX, SOCK_STREAM, 0); | 57 | pri->control = socket(AF_UNIX, SOCK_STREAM, 0); |
58 | if(pri->control < 0){ | 58 | if(pri->control < 0){ |
59 | err = -errno; | ||
59 | printk("daemon_open : control socket failed, errno = %d\n", | 60 | printk("daemon_open : control socket failed, errno = %d\n", |
60 | errno); | 61 | -err); |
61 | return(-errno); | 62 | return err; |
62 | } | 63 | } |
63 | 64 | ||
64 | if(connect(pri->control, (struct sockaddr *) ctl_addr, | 65 | if(connect(pri->control, (struct sockaddr *) ctl_addr, |
65 | sizeof(*ctl_addr)) < 0){ | 66 | sizeof(*ctl_addr)) < 0){ |
66 | printk("daemon_open : control connect failed, errno = %d\n", | ||
67 | errno); | ||
68 | err = -errno; | 67 | err = -errno; |
68 | printk("daemon_open : control connect failed, errno = %d\n", | ||
69 | -err); | ||
69 | goto out; | 70 | goto out; |
70 | } | 71 | } |
71 | 72 | ||
72 | fd = socket(AF_UNIX, SOCK_DGRAM, 0); | 73 | fd = socket(AF_UNIX, SOCK_DGRAM, 0); |
73 | if(fd < 0){ | 74 | if(fd < 0){ |
74 | printk("daemon_open : data socket failed, errno = %d\n", | ||
75 | errno); | ||
76 | err = -errno; | 75 | err = -errno; |
76 | printk("daemon_open : data socket failed, errno = %d\n", | ||
77 | -err); | ||
77 | goto out; | 78 | goto out; |
78 | } | 79 | } |
79 | if(bind(fd, (struct sockaddr *) local_addr, sizeof(*local_addr)) < 0){ | 80 | if(bind(fd, (struct sockaddr *) local_addr, sizeof(*local_addr)) < 0){ |
80 | printk("daemon_open : data bind failed, errno = %d\n", | ||
81 | errno); | ||
82 | err = -errno; | 81 | err = -errno; |
82 | printk("daemon_open : data bind failed, errno = %d\n", | ||
83 | -err); | ||
83 | goto out_close; | 84 | goto out_close; |
84 | } | 85 | } |
85 | 86 | ||