summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2010-05-25 20:21:54 +0000
committerAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2010-05-25 20:21:54 +0000
commitdc3744a71ca2db4a938ef0ae41ec551f708ceb02 (patch)
treea477049a19ef28c1f179259198d548b347f58448
parenta36e536a4d5f3e25c50331d3d85cc7ea105eb25e (diff)
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
-rw-r--r--src/modulemanager.cpp13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp
index 0716e4503..c4bceb119 100644
--- a/src/modulemanager.cpp
+++ b/src/modulemanager.cpp
@@ -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