From 02fecf70e20ceead39137a61916d1d5e479853b2 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Thu, 13 Sep 2001 19:42:28 +0000 Subject: Make sure the dir pointer is non-NULL before using it. 2001-09-13 Jeffrey Stedfast * e-mktemp.c (e_mktemp_cleanup): Make sure the dir pointer is non-NULL before using it. svn path=/trunk/; revision=12807 --- e-util/e-mktemp.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'e-util/e-mktemp.c') diff --git a/e-util/e-mktemp.c b/e-util/e-mktemp.c index e532498c1d..1d878b1ba0 100644 --- a/e-util/e-mktemp.c +++ b/e-util/e-mktemp.c @@ -127,15 +127,17 @@ e_mktemp_cleanup (void) /* first empty out this directory of it's files... */ dir = opendir (node->data); - while ((dent = readdir (dir)) != NULL) { - /* yea...so if we contain - subdirectories this won't work, but - it shouldn't so we won't - bother caring... */ - if (strcmp (dent->d_name, ".") && strcmp (dent->d_name, "..")) - unlink (dent->d_name); + if (dir) { + while ((dent = readdir (dir)) != NULL) { + /* yea...so if we contain + subdirectories this won't work, but + it shouldn't so we won't + bother caring... */ + if (strcmp (dent->d_name, ".") && strcmp (dent->d_name, "..")) + unlink (dent->d_name); + } + closedir (dir); } - closedir (dir); /* ...then rmdir the directory */ rmdir (node->data); -- cgit