gala-gopher/fix-httpprobe-find-libssl-path.patch
xietangxin 7a98e4aa4d sync bugfix
(cherry picked from commit f80b9a43fd947043bd90d948c921daeabc1f3b96)
2023-06-13 09:59:46 +08:00

51 lines
2.2 KiB
Diff

From 78afbbed90b312ff308b5be0fba24d42a3f122ca Mon Sep 17 00:00:00 2001
From: xietangxin <xietangxin@huawei.com>
Date: Thu, 13 Apr 2023 14:35:00 +0800
Subject: [PATCH] fix httpprobe find libssl path
---
src/daemon/daemon.c | 2 +-
src/probes/extends/ebpf.probe/src/httpprobe/httpprobe.c | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c
index b10ca60..3b16a75 100644
--- a/src/daemon/daemon.c
+++ b/src/daemon/daemon.c
@@ -172,7 +172,7 @@ static void DaemonKeeplive(int sig)
(void)pthread_detach(probe->tid);
INFO("[DAEMON] keeplive create probe(%s) thread.\n", probe->name);
- break;
+ continue;
}
}
return;
diff --git a/src/probes/extends/ebpf.probe/src/httpprobe/httpprobe.c b/src/probes/extends/ebpf.probe/src/httpprobe/httpprobe.c
index 477fe43..e64a706 100644
--- a/src/probes/extends/ebpf.probe/src/httpprobe/httpprobe.c
+++ b/src/probes/extends/ebpf.probe/src/httpprobe/httpprobe.c
@@ -42,6 +42,7 @@
#define APACHE_PATH "which httpd"
#define NGINX_SSL_PATH "ldd $(which nginx) | grep libssl | awk '{print $3}'"
#define APACHE_SSL_PATH "ldd /etc/httpd/modules/mod_ssl.so | grep libssl | awk '{print $3}'"
+#define HTTPD_SSL_PATH "/etc/httpd/modules/mod_ssl.so"
#define LOAD_HTTP_PROBE(probe_name, end, load) \
OPEN(probe_name, end, load); \
@@ -81,8 +82,9 @@ static void get_libssl_path(char *nginx_sslpath, char *apache_sslpath)
}
pclose(f1);
f1 = popen(APACHE_PATH, "r");
- if (fgets(buf, PATH_LEN, f1) != NULL && strlen(buf) > 0 && !(buf[strlen(buf) - 1] = 0) && access(buf, F_OK) == 0) {
- if ((f2 = popen(NGINX_SSL_PATH, "r")) != NULL && fgets(apache_sslpath, PATH_LEN, f2) != NULL) {
+ if (fgets(buf, PATH_LEN, f1) != NULL && strlen(buf) > 0 && !(buf[strlen(buf) - 1] = 0) &&
+ access(buf, F_OK) == 0 && access(HTTPD_SSL_PATH, F_OK) == 0) {
+ if ((f2 = popen(APACHE_SSL_PATH, "r")) != NULL && fgets(apache_sslpath, PATH_LEN, f2) != NULL) {
if (strlen(apache_sslpath) != 0) {
apache_sslpath[strlen(apache_sslpath) - 1] = 0;
}
--
2.33.0