aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-local-storage.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2000-05-07 10:22:08 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2000-05-07 10:22:08 +0800
commitfe27ab117972b1d98792ee0c78abce0a3c4a0acb (patch)
treee62ce3cab9a074917276ffb2ab3ee91e56deb11d /shell/e-local-storage.c
parent3219faad0c583cf44add809ded9183ccc9c4f302 (diff)
downloadgsoc2013-evolution-fe27ab117972b1d98792ee0c78abce0a3c4a0acb.tar
gsoc2013-evolution-fe27ab117972b1d98792ee0c78abce0a3c4a0acb.tar.gz
gsoc2013-evolution-fe27ab117972b1d98792ee0c78abce0a3c4a0acb.tar.bz2
gsoc2013-evolution-fe27ab117972b1d98792ee0c78abce0a3c4a0acb.tar.lz
gsoc2013-evolution-fe27ab117972b1d98792ee0c78abce0a3c4a0acb.tar.xz
gsoc2013-evolution-fe27ab117972b1d98792ee0c78abce0a3c4a0acb.tar.zst
gsoc2013-evolution-fe27ab117972b1d98792ee0c78abce0a3c4a0acb.zip
Portability fix (use `readdir()', not `readdir_r()'). Also, be safer
about NULL objects when destroying the shell or the shortcuts. svn path=/trunk/; revision=2850
Diffstat (limited to 'shell/e-local-storage.c')
-rw-r--r--shell/e-local-storage.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/shell/e-local-storage.c b/shell/e-local-storage.c
index d4d30d67c5..f559d30f34 100644
--- a/shell/e-local-storage.c
+++ b/shell/e-local-storage.c
@@ -150,7 +150,6 @@ load_folders (ELocalStorage *local_storage,
{
DIR *dir;
char *subfolder_directory_path;
- struct dirent *dirent;
if (parent_path == NULL) {
/* On the top level, we don't have any folders and, consequently, no
@@ -181,24 +180,21 @@ load_folders (ELocalStorage *local_storage,
return FALSE;
}
- dirent = g_malloc (sizeof (struct dirent) + MAXPATHLEN + 1);
-
while (1) {
struct stat file_stat;
- struct dirent *result;
+ struct dirent *dirent;
char *file_path;
char *new_path;
- if (readdir_r (dir, dirent, &result) != 0)
- break;
- if (result == NULL)
+ dirent = readdir (dir);
+ if (dirent == NULL)
break;
- if (strcmp (result->d_name, ".") == 0 || strcmp (result->d_name, "..") == 0)
+ if (strcmp (dirent->d_name, ".") == 0 || strcmp (dirent->d_name, "..") == 0)
continue;
file_path = g_concat_dir_and_file (subfolder_directory_path,
- result->d_name);
+ dirent->d_name);
if (stat (file_path, &file_stat) < 0) {
g_free (file_path);
@@ -209,7 +205,7 @@ load_folders (ELocalStorage *local_storage,
continue;
}
- new_path = g_concat_dir_and_file (path, result->d_name);
+ new_path = g_concat_dir_and_file (path, dirent->d_name);
load_folders (local_storage, path, new_path, file_path);
@@ -217,7 +213,6 @@ load_folders (ELocalStorage *local_storage,
g_free (new_path);
}
- g_free (dirent);
closedir (dir);
g_free (subfolder_directory_path);