diff --git a/lfs/squidguard b/lfs/squidguard
index c5decc79f..b42110c5f 100644
--- a/lfs/squidguard
+++ b/lfs/squidguard
@@ -72,6 +72,8 @@ $(subst %,%_BLAKE2,$(objects)) :
 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 	@$(PREBUILD)
 	@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
+	cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/squidguard-1.6.0-stdlib.patch
+	cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/squidguard-1.6.0-configure.patch
 	cd $(DIR_APP) && ./autogen.sh
 	cd $(DIR_APP) && ./configure \
 		--prefix=/usr \
diff --git a/src/patches/squidguard-1.6.0-configure.patch b/src/patches/squidguard-1.6.0-configure.patch
new file mode 100644
index 000000000..22c87498d
--- /dev/null
+++ b/src/patches/squidguard-1.6.0-configure.patch
@@ -0,0 +1,55 @@
+--- squidguard-1.6.0/configure.ac~	2024-08-06 10:40:16.797400705 +0000
++++ squidguard-1.6.0/configure.ac	2024-08-06 10:41:36.321245621 +0000
+@@ -237,7 +237,7 @@
+         {
+            LDAP *p;
+            p = ldap_init("localhost", LDAP_PORT);
+-           exit(0);
++           return 0;
+         }
+         ]])],,[
+            echo
+@@ -358,8 +358,8 @@
+ #endif
+         ver = major + ((float) minor / 1000);
+         if (ver >= 2.006)
+-			exit (0);
+-		exit (1);
++			return 0;
++		return 1;
+ 	}	
+ 	]])],
+ 	[db_ok_version=yes],
+@@ -396,8 +396,8 @@
+ #endif
+         ver = major + ((float) minor / 1000);
+         if (ver > 2.007 && ver < 3.002)
+-			exit (1);
+-		exit (0);
++			return 1;
++		return 0;
+ 	}	
+ 	]])],
+ 	[db_ok_version=yes],
+@@ -432,8 +432,8 @@
+ #endif
+         ver = major + ((float) minor / 1000);
+         if (ver >= 3.002)
+-			exit (0);
+-		exit (1);
++			return 0;
++		return 1;
+ 	}	
+ 	]])],
+ 	[dbg2_ok_version=yes],
+@@ -460,8 +460,8 @@
+ #endif
+         ver = major + ((float) minor / 1000);
+         if (ver >= 4.002)
+-			exit (0);
+-		exit (1);
++			return 0;
++		return 1;
+ 	}	
+ 	]])],
+ 	[dbg3_ok_version=yes],
diff --git a/src/patches/squidguard-1.6.0-stdlib.patch b/src/patches/squidguard-1.6.0-stdlib.patch
new file mode 100644
index 000000000..51489b32d
--- /dev/null
+++ b/src/patches/squidguard-1.6.0-stdlib.patch
@@ -0,0 +1,22 @@
+--- a/configure.ac	2022-12-15 10:33:13.845801113 +0300
++++ b/configure.ac	2022-12-15 10:33:39.828949903 +0300
+@@ -342,6 +342,9 @@
+ LIBS="$LIBS -ldb"
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+     #include <db.h>
++    #ifdef HAVE_STDLIB_H
++        #include <stdlib.h>
++    #endif
+     int main() 
+     {
+         int major, minor, patch;
+@@ -377,6 +378,9 @@
+ 
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+     #include <db.h>
++    #ifdef HAVE_STDLIB_H
++        #include <stdlib.h>
++    #endif
+     int main() 
+     {
+         int major, minor, patch;
