diff options
Diffstat (limited to 'e-util/e-mktemp.c')
-rw-r--r-- | e-util/e-mktemp.c | 18 |
1 files changed, 10 insertions, 8 deletions
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); |