aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-mktemp.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-09-14 03:42:28 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-09-14 03:42:28 +0800
commit02fecf70e20ceead39137a61916d1d5e479853b2 (patch)
treefd753561771d30e206307de5b415ce2382d991b3 /e-util/e-mktemp.c
parentb280d814d60baee0a3fb9f6885f1a0c4b9553606 (diff)
downloadgsoc2013-evolution-02fecf70e20ceead39137a61916d1d5e479853b2.tar
gsoc2013-evolution-02fecf70e20ceead39137a61916d1d5e479853b2.tar.gz
gsoc2013-evolution-02fecf70e20ceead39137a61916d1d5e479853b2.tar.bz2
gsoc2013-evolution-02fecf70e20ceead39137a61916d1d5e479853b2.tar.lz
gsoc2013-evolution-02fecf70e20ceead39137a61916d1d5e479853b2.tar.xz
gsoc2013-evolution-02fecf70e20ceead39137a61916d1d5e479853b2.tar.zst
gsoc2013-evolution-02fecf70e20ceead39137a61916d1d5e479853b2.zip
Make sure the dir pointer is non-NULL before using it.
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. svn path=/trunk/; revision=12807
Diffstat (limited to 'e-util/e-mktemp.c')
-rw-r--r--e-util/e-mktemp.c18
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);