summaryrefslogtreecommitdiffstats
path: root/browser.c
diff options
context:
space:
mode:
authorMichael Elkins <me@sigpipe.org>2013-04-10 22:38:47 +0000
committerMichael Elkins <me@sigpipe.org>2013-04-10 22:38:47 +0000
commit564787560c432d02dfc311ec3489f227d2a56abb (patch)
tree0cba759d6b7b1fd0a44d02ed8e68cb7b3bd00267 /browser.c
parent72e8127293f8fee15e9f68efaaf85bfc10310463 (diff)
fix various compiler warnings; most were due to unchecked return values from system calls.
Diffstat (limited to 'browser.c')
-rw-r--r--browser.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/browser.c b/browser.c
index cda4900a..3d69b9d4 100644
--- a/browser.c
+++ b/browser.c
@@ -615,7 +615,11 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num
}
else
{
- getcwd (LastDir, sizeof (LastDir));
+ if (getcwd (LastDir, sizeof (LastDir)) == NULL)
+ {
+ dprint(1, (debugfile, "%s:%d getcwd() returned NULL\n", __FILE__, __LINE__));
+ LastDir[0] = '\0';
+ }
safe_strcat (LastDir, sizeof (LastDir), "/");
safe_strncat (LastDir, sizeof (LastDir), f, i);
}
@@ -625,7 +629,13 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num
if (f[0] == '/')
strcpy (LastDir, "/"); /* __STRCPY_CHECKED__ */
else
- getcwd (LastDir, sizeof (LastDir));
+ {
+ if (getcwd (LastDir, sizeof (LastDir)) == NULL)
+ {
+ dprint(1, (debugfile, "%s:%d getcwd() returned NULL\n", __FILE__, __LINE__));
+ LastDir[0] = '\0';
+ }
+ }
}
if (i <= 0 && f[0] != '/')
@@ -640,7 +650,13 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num
else
{
if (!folder)
- getcwd (LastDir, sizeof (LastDir));
+ {
+ if (getcwd (LastDir, sizeof (LastDir)) == NULL)
+ {
+ dprint(1, (debugfile, "%s:%d getcwd() returned NULL\n", __FILE__, __LINE__));
+ LastDir[0] = '\0';
+ }
+ }
else if (!LastDir[0])
strfcpy (LastDir, NONULL(Maildir), sizeof (LastDir));
@@ -659,7 +675,13 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num
while (i && LastDir[--i] == '/')
LastDir[i] = '\0';
if (!LastDir[0])
- getcwd (LastDir, sizeof (LastDir));
+ {
+ if (getcwd (LastDir, sizeof (LastDir)) == NULL)
+ {
+ dprint(1, (debugfile, "%s:%d getcwd() returned NULL\n", __FILE__, __LINE__));
+ LastDir[0] = '\0';
+ }
+ }
}
}