403Webshell
Server IP : 82.208.35.60  /  Your IP : 216.73.216.238
Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31
System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64
User : studiokobylisy_cz ( 1008)
PHP Version : 7.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/ports/net/spread/files/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/ports/net/spread/files/patch-spread.c
--- ./spread.c.orig	2006-11-20 05:53:13.000000000 +0100
+++ ./spread.c	2012-07-20 21:55:23.000000000 +0200
@@ -48,6 +48,8 @@
 #include <pwd.h>
 #include <unistd.h>
 #include <sys/types.h>
+#include <errno.h>
+#include <stdlib.h>
 #endif
 
 #ifdef	ARCH_PC_WIN95
@@ -65,6 +67,7 @@
 
 static	void	Invalid_privilege_decrease(char *user, char *group);
 static	void	Usage(int argc, char *argv[]);
+static	void	writepidfile();
 
 /* auth-null.c: */
 void null_init(void);
@@ -144,6 +147,11 @@
 
 #endif	/* ARCH_PC_WIN95 */
 
+	if (daemon(0,0) == -1)
+		Alarm( EXIT, "Spread: couldn't daemonise: %d", strerror(errno) );
+
+	writepidfile();
+
         /* initialize each valid authentication protocol */
         null_init();
         ip_init();
@@ -195,6 +203,20 @@
 	return 0;
 }
 
+static void
+writepidfile()
+{
+	char pidbuf[11];
+	int pidfd;
+
+	if ((pidfd = open(_PATH_SPREAD_PIDDIR "/spread.pid", O_RDWR | O_CREAT, 0644)) == -1)
+		Alarm( EXIT, "Spread: couldn't open pidfile for writing" );
+
+	snprintf(pidbuf, sizeof(pidbuf), "%ld\n", (long)getpid());
+	write(pidfd, pidbuf, strlen(pidbuf));
+	close(pidfd);
+}
+
 static  void    Print_help(void)
 {
     Alarmp( SPLOG_FATAL, SYSTEM, "Usage: spread\n%s\n%s\n%s\n",

Youez - 2016 - github.com/yon3zu
LinuXploit