Browse code

Use setsid if setpgrp not present

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@136 77e5149b-7576-45b1-b177-96237e5ba77b

Nigel Horne authored on 2003/12/02 15:39:22
Showing 3 changed files
... ...
@@ -1,3 +1,8 @@
1
+Tue Dec  2 06:38:13 GMT 2003 (njh)
2
+----------------------------------
3
+  * clamav-milter: use setsid if setpgrp not available
4
+	Thanks to Eugene Crosser <crosser@rol.ru> and Tomasz
5
+
1 6
 Mon Dec  1 23:51:25 CET 2003 (tk)
2 7
 ---------------------------------
3 8
   * libclamav: maxratio added to cl_limits
... ...
@@ -162,6 +162,8 @@ Changes
162 162
 		Fix by Michael Dankov <misha@btrc.ru>.
163 163
 0.65f	29/11/03 Added --quarantine-dir
164 164
 		Thanks to Michael Dankov <misha@btrc.ru>.
165
+0.65g	2/12/03	Use setsid if setpgrp is not present.
166
+		Thanks to Eugene Crosser <crosser@rol.ru>
165 167
 
166 168
 BUG REPORTS
167 169
 
... ...
@@ -79,7 +79,7 @@
79 79
  * -lgnugetopt
80 80
  *	gcc30 -O3 -DCONFDIR=\"/usr/local/etc\" -I. -I.. -I../clamd -I../libclamav -pedantic -Wuninitialized -Wall -pipe -mcpu=pentium -march=pentium -fomit-frame-pointer -ffast-math -finline-functions -funroll-loops clamav-milter.c -pthread -lmilter ../libclamav/.libs/libclamav.a ../clamd/cfgfile.o ../clamd/others.o -lgnugetopt
81 81
  *
82
- * FreeBSD4.8: should compile out of the box
82
+ * FreeBSD4.8: compiles out of the box with either gcc2.95 or gcc3
83 83
  * OpenBSD3.3: the supplied sendmail does not come with Milter support. You
84 84
  * will need to rebuild sendmail from source
85 85
  *
... ...
@@ -165,9 +165,14 @@
165 165
  *			Fix by Michael Dankov <misha@btrc.ru>.
166 166
  *	0.65f	29/11/03 Added --quarantine-dir
167 167
  *			Thanks to Michael Dankov <misha@btrc.ru>.
168
+ *	0.65g	2/12/03	Use setsid if setpgrp is not present.
169
+ *			Thanks to Eugene Crosser <crosser@rol.ru>
168 170
  *
169 171
  * Change History:
170 172
  * $Log: clamav-milter.c,v $
173
+ * Revision 1.26  2003/12/02 06:37:26  nigelhorne
174
+ * Use setsid if setpgrp not present
175
+ *
171 176
  * Revision 1.25  2003/11/30 06:12:06  nigelhorne
172 177
  * Added --quarantine-dir option
173 178
  *
... ...
@@ -228,9 +233,9 @@
228 228
  * Revision 1.6  2003/09/28 16:37:23  nigelhorne
229 229
  * Added -f flag use MaxThreads if --max-children not set
230 230
  */
231
-static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.25 2003/11/30 06:12:06 nigelhorne Exp $";
231
+static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.26 2003/12/02 06:37:26 nigelhorne Exp $";
232 232
 
233
-#define	CM_VERSION	"0.65f"
233
+#define	CM_VERSION	"0.65g"
234 234
 
235 235
 /*#define	CONFDIR	"/usr/local/etc"*/
236 236
 
... ...
@@ -699,7 +704,17 @@ main(int argc, char **argv)
699 699
 		open("/dev/null", O_RDONLY);
700 700
 		if(open("/dev/console", O_WRONLY) == 1)
701 701
 			dup(1);
702
+#ifdef HAVE_SETPGRP
703
+#ifdef SETPGRP_VOID
702 704
 		setpgrp();
705
+#else
706
+		setpgrp(0,0);
707
+#endif
708
+#else
709
+#ifdef HAVE_SETSID
710
+		 setsid();
711
+#endif
712
+#endif
703 713
 	}
704 714
 
705 715
 	if(smfi_setconn(port) == MI_FAILURE) {