File unrealircd-tmpdir.patch of Package unrealircd-3.2.9

Index: src/ircd.c
===================================================================
--- src/ircd.c.orig
+++ src/ircd.c
@@ -1407,9 +1407,9 @@ int InitwIRCD(int argc, char *argv[])
 	}
 #endif
 #ifndef _WIN32
-	mkdir("tmp", S_IRUSR|S_IWUSR|S_IXUSR); /* Create the tmp dir, if it doesn't exist */
+	mkdir(TMPPATH, S_IRUSR|S_IWUSR|S_IXUSR); /* Create the tmp dir, if it doesn't exist */
  #if defined(USE_LIBCURL) && defined(REMOTEINC_SPECIALCACHE)
- 	mkdir("cache", S_IRUSR|S_IWUSR|S_IXUSR); /* Create the cache dir, if using curl and it doesn't exist */
+ 	mkdir(CACHEPATH, S_IRUSR|S_IWUSR|S_IXUSR); /* Create the cache dir, if using curl and it doesn't exist */
  #endif
 #else
 	mkdir("tmp");
Index: include/config.h
===================================================================
--- include/config.h.orig
+++ include/config.h
@@ -237,12 +237,13 @@
 #define SMPATH          "ircd.smotd"    /* short MOTD file */
 #define RPATH   	"ircd.rules"	/* server rules file */
 #define OPATH   	"oper.motd"	/* Operators MOTD file */
-#define	LPATH		"debug.log"	/* Where the debug file lives, if DEBUGMODE */
-#define	PPATH		"ircd.pid"	/* file for server pid */
+#define	LPATH		"/var/log/Unreal/debug.log"	/* Where the debug file lives, if DEBUGMODE */
+#define	PPATH		"/var/run/Unreal/ircd.pid"	/* file for server pid */
 #define VPATH		"ircd.svsmotd"	/* Services MOTD append. */
 #define BPATH		"bot.motd"	/* Bot MOTD */
-#define IRCDTUNE 	"ircd.tune"	/* tuning .. */
-
+#define IRCDTUNE	"/var/lib/Unreal/ircd.tune"	/* tuning .. */
+#define TMPPATH		"/var/run/Unreal/tmp"
+#define CACHEPATH	"/var/run/Unreal/cache"
 /* CHROOTDIR
  *
  * This enables running the IRCd chrooted (requires initial root privileges,
Index: src/modules.c
===================================================================
--- src/modules.c.orig
+++ src/modules.c
@@ -183,12 +183,12 @@ void DeleteTempModules(void)
 {
 	char tempbuf[PATH_MAX+1];
 #ifndef _WIN32
-	DIR *fd = opendir("tmp");
+	DIR *fd = opendir(TMPPATH);
 	struct dirent *dir;
 
 	if (!fd) /* Ouch.. this is NOT good!! */
 	{
-		config_error("Unable to open 'tmp' directory: %s, please create one with the appropriate permissions",
+		config_error("Unable to open '" TMPPATH "' directory: %s, please create one with the appropriate permissions",
 			strerror(errno));
 		if (!loop.ircd_booted)
 			exit(7);
@@ -199,7 +199,7 @@ void DeleteTempModules(void)
 	{
 		if (!strcmp(dir->d_name, ".") || !strcmp(dir->d_name, ".."))
 			continue;
-		strcpy(tempbuf, "tmp/");
+		strcpy(tempbuf, TMPPATH"/");
 		strcat(tempbuf, dir->d_name);
 		remove(tempbuf);
 	}
@@ -329,7 +329,7 @@ char  *Module_Create(char *path_)
 	path = path_;
 
 	
-	tmppath = unreal_mktemp("tmp", unreal_getfilename(path));
+	tmppath = unreal_mktemp(TMPPATH, unreal_getfilename(path));
 	if (!tmppath)
 		return "Unable to create temporary file!";
 #ifndef _WIN32
Index: src/s_conf.c
===================================================================
--- src/s_conf.c.orig
+++ src/s_conf.c
@@ -9652,7 +9652,7 @@ static void conf_download_complete(const
 	{
 		char *urlfile = url_getfilename(url);
 		char *file_basename = unreal_getfilename(urlfile);
-		char *tmp = unreal_mktemp("tmp", file_basename);
+		char *tmp = unreal_mktemp(TMPPATH, file_basename);
 		free(urlfile);
 
 		if (cached)
Index: src/url.c
===================================================================
--- src/url.c.orig
+++ src/url.c
@@ -147,7 +147,7 @@ char *download_file(const char *url, cha
 	CURLcode res;
 	char *file = url_getfilename(url);
 	char *filename = unreal_getfilename(file);
-	char *tmp = unreal_mktemp("tmp", filename ? filename : "download.conf");
+	char *tmp = unreal_mktemp(TMPPATH, filename ? filename : "download.conf");
 	FILE *fd;
 
 
@@ -253,7 +253,7 @@ void download_file_async(const char *url
 	{
 		char *file = url_getfilename(url);
 		char *filename = unreal_getfilename(file);
-        	char *tmp = unreal_mktemp("tmp", filename ? filename : "download.conf");
+        	char *tmp = unreal_mktemp(TMPPATH, filename ? filename : "download.conf");
 		FileHandle *handle = malloc(sizeof(FileHandle));
 		handle->fd = fopen(tmp, "wb");
 		if (!handle->fd)