diff options
-rw-r--r-- | e-util/ChangeLog | 5 | ||||
-rw-r--r-- | e-util/e-mktemp.c | 18 |
2 files changed, 15 insertions, 8 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog index bb0ebf0a21..056ae07197 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,8 @@ +2001-09-13 Jeffrey Stedfast <fejj@ximian.com> + + * e-mktemp.c (e_mktemp_cleanup): Make sure the dir pointer is + non-NULL before using it. + 2001-09-08 Dan Winship <danw@ximian.com> * e-html-utils.c (e_text_to_html_full): Fix some broken calls to 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); |