summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2016-01-03 03:33:48 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2016-01-03 03:40:19 +0100
commit046b776f2eb0f5b2fb26f86e987fc8185f8a6444 (patch)
treee24ee9500204d6735c43cf6b7dc2746ccbfdc762
parent05e6878c8767cf7006675d5e5a646b2f74aa88c7 (diff)
Add dumb SO_ERROR support to pflocal
pflocal does not currently have asynchronous operations, so we can make SO_ERROR just report 0. * pflocal/socket.c (S_socket_getopt): For `level' SOL_SOCKET and `opt' SO_ERROR, report 0.
-rw-r--r--pflocal/socket.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/pflocal/socket.c b/pflocal/socket.c
index 58449047..b1f9d770 100644
--- a/pflocal/socket.c
+++ b/pflocal/socket.c
@@ -445,6 +445,25 @@ S_socket_getopt (struct sock_user *user,
*(int *)*value = user->sock->pipe_class->sock_type;
*value_len = sizeof (int);
break;
+ case SO_ERROR:
+ /* We do not have asynchronous operations (such as connect), so no
+ error to report. */
+ if (*value_len < sizeof (short))
+ {
+ *(char*)*value = 0;
+ *value_len = sizeof(char);
+ }
+ else if (*value_len < sizeof (int))
+ {
+ *(short*)*value = 0;
+ *value_len = sizeof(short);
+ }
+ else
+ {
+ *(int*)*value = 0;
+ *value_len = sizeof(int);
+ }
+ break;
default:
ret = ENOPROTOOPT;
break;