File: 0001-Check-return-value-of-remove.patch

package info (click to toggle)
ocserv 1.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,924 kB
  • sloc: ansic: 46,747; sh: 12,630; makefile: 412; xml: 29
file content (32 lines) | stat: -rw-r--r-- 1,080 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From 6746d1d6f41382bdb264576bdfbf20f95c6b30ba Mon Sep 17 00:00:00 2001
From: Dimitri Papadopoulos
 <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
Date: Tue, 25 Jun 2024 22:13:21 +0200
Subject: [PATCH] Check return value of remove()

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
---
 src/main-ctl-unix.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/main-ctl-unix.c b/src/main-ctl-unix.c
index 856954a4..1354bee6 100644
--- a/src/main-ctl-unix.c
+++ b/src/main-ctl-unix.c
@@ -131,7 +131,12 @@ int ctl_handler_init(main_server_st * s)
 	memset(&sa, 0, sizeof(sa));
 	sa.sun_family = AF_UNIX;
 	strlcpy(sa.sun_path, GETPCONFIG(s)->occtl_socket_file, sizeof(sa.sun_path));
-	remove(GETPCONFIG(s)->occtl_socket_file);
+	ret = remove(GETPCONFIG(s)->occtl_socket_file);
+	if (ret != 0) {
+		e = errno;
+		mslog(s, NULL, LOG_DEBUG, "could not delete socket: '%s': %s",
+		      GETPCONFIG(s)->occtl_socket_file, strerror(e));
+	}
 
 	sd = socket(AF_UNIX, SOCK_STREAM, 0);
 	if (sd == -1) {
-- 
2.39.5