1
0
mirror of https://github.com/anope/anope.git synced 2026-06-27 15:26:41 +02:00

Check if a module file exists before making runtime copy of it, keeps 0 byte sized unused modules out of the runtime/ directory

git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2984 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
Adam-
2010-05-25 20:21:54 +00:00
parent a36e536a4d
commit dc3744a71c
+3 -10
View File
@@ -48,6 +48,9 @@ static int moduleCopyFile(const char *name, const char *output)
strlcat(input, name, sizeof(input));
strlcat(input, MODULE_EXT, sizeof(input));
if ((source = fopen(input, "rb")) == NULL)
return MOD_ERR_NOEXIST;
#ifndef _WIN32
if ((srcfp = mkstemp(const_cast<char *>(output))) == -1)
return MOD_ERR_FILE_IO;
@@ -58,16 +61,6 @@ static int moduleCopyFile(const char *name, const char *output)
Alog(LOG_DEBUG) << "Runtime module location: " << output;
/* Linux/UNIX should ignore the b param, why do we still have seperate
* calls for it here? -GD
*/
#ifndef _WIN32
if ((source = fopen(input, "r")) == NULL) {
#else
if ((source = fopen(input, "rb")) == NULL) {
#endif
return MOD_ERR_NOEXIST;
}
#ifndef _WIN32
if ((target = fdopen(srcfp, "w")) == NULL) {
#else