summaryrefslogtreecommitdiff
path: root/src/configreader.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-11-19 00:43:35 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-11-19 00:43:35 +0000
commit715984299881265e3659c412d68139255d8c64e7 (patch)
treebdc96ed41c3c419cbddadd89cb9c7d51687884da /src/configreader.cpp
parent91c14cde8b5c1dd5bd503288cf10bc98084a1b95 (diff)
Fix all the _FORTIFY_SOURCE warnings except "punned pointer".
We CANNOT fix this, as it is the recommended (and only) way to dlsym a symbol from a .so file. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5770 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/configreader.cpp')
-rw-r--r--src/configreader.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp
index c854d2ec4..71fd9e6b9 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -1310,7 +1310,7 @@ int ServerConfig::ConfVarEnum(ConfigDataHash &target, const std::string &tag, in
*/
bool ServerConfig::ReadFile(file_cache &F, const char* fname)
{
- FILE* file;
+ FILE* file = NULL;
char linebuf[MAXBUF];
F.clear();
@@ -1334,8 +1334,10 @@ bool ServerConfig::ReadFile(file_cache &F, const char* fname)
{
while (!feof(file))
{
- fgets(linebuf, sizeof(linebuf), file);
- linebuf[strlen(linebuf)-1] = 0;
+ if (fgets(linebuf, sizeof(linebuf), file))
+ linebuf[strlen(linebuf)-1] = 0;
+ else
+ *linebuf = 0;
if (!feof(file))
{
@@ -1399,12 +1401,14 @@ bool ServerConfig::DirValid(const char* dirandfile)
if (getcwd(buffer, MAXBUF ) == NULL )
return false;
- chdir(work);
+ if (chdir(work) == -1)
+ return false;
if (getcwd(otherdir, MAXBUF ) == NULL )
return false;
- chdir(buffer);
+ if (chdir(buffer) == -1)
+ return false;
size_t t = strlen(work);
@@ -1451,12 +1455,15 @@ std::string ServerConfig::GetFullProgDir(char** argv, int argc)
if (getcwd(buffer, MAXBUF) == NULL)
return "";
- chdir(work);
+ if (chdir(work) == -1)
+ return "";
if (getcwd(otherdir, MAXBUF) == NULL)
return "";
- chdir(buffer);
+ if (chdir(buffer) == -1)
+ return "";
+
return otherdir;
}