emacs-patch-review
Port of Thunderbird Patch Review to mu4e.
git clone git://mccd.space/emacs-patch-review| Log | Files | Refs | README | Mail |
patch1.eml (869B)
1 From: Aisha Developer <aisha@example.org>
2 To: project-dev@lists.example.org
3 Cc: Reviewers <review@lists.example.org>
4 Subject: [PATCH 1/3] Reject negative descriptors in socket paths
5 Date: Sat, 18 Jul 2026 09:41:12 +0200
6 Message-ID: <patch1@example.org>
7
8 Reject negative descriptors in both open and close paths and
9 report EBADF like the rest of the subsystem does.
10 ---
11 src/socket.c | 7 ++++++-
12 1 file changed, 6 insertions(+), 1 deletion(-)
13
14 diff --git a/src/socket.c b/src/socket.c
15 index ceba5c8..6eab6c5 100644
16 --- a/src/socket.c
17 +++ b/src/socket.c
18 @@ -1,15 +1,20 @@
19 #include <stdio.h>
20 +#include <errno.h>
21
22 int open_socket(int fd)
23 {
24 - if (fd < 0)
25 + if (fd < 0) {
26 + errno = EBADF;
27 return -1;
28 + }
29 printf("opening %d\n", fd);
30 return fd;
31 }
32
33 int close_socket(int fd)
34 {
35 + if (fd < 0)
36 + return -1;
37 printf("closing %d\n", fd);
38 return 0;
39 }
40 --
41 2.55.0
42