thunderbird-patch-review
Easy-to-use patch review interface for Thunderbird
Contribute: ~marcc/thunderbird-review-plugin@lists.sr.ht
git clone git://mccd.space/thunderbird-patch-review
| Log | Files | Refs | README | LICENSE |
patch1.body (615B)
1 Reject negative descriptors in both open and close paths and
2 report EBADF like the rest of the subsystem does.
3 ---
4 src/socket.c | 7 ++++++-
5 1 file changed, 6 insertions(+), 1 deletion(-)
6
7 diff --git a/src/socket.c b/src/socket.c
8 index ceba5c8..6eab6c5 100644
9 --- a/src/socket.c
10 +++ b/src/socket.c
11 @@ -1,15 +1,20 @@
12 #include <stdio.h>
13 +#include <errno.h>
14
15 int open_socket(int fd)
16 {
17 - if (fd < 0)
18 + if (fd < 0) {
19 + errno = EBADF;
20 return -1;
21 + }
22 printf("opening %d\n", fd);
23 return fd;
24 }
25
26 int close_socket(int fd)
27 {
28 + if (fd < 0)
29 + return -1;
30 printf("closing %d\n", fd);
31 return 0;
32 }
33 --
34 2.55.0
35