Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/eglib
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@gnome.org>2006-10-22 03:14:03 +0400
committerMiguel de Icaza <miguel@gnome.org>2006-10-22 03:14:03 +0400
commit310aa2cb3936b9d9d8cadae86a687e809bd3f20e (patch)
treecf9262d529118485b19b60bf6218ece58c68b777 /eglib
parenta941c11b2dcd88359cf8f1a50c8b312cb427772f (diff)
This makes gacutil work\n2006-10-21 Miguel de Icaza <miguel@novell.com>
* src/gdir.c (g_dir_read_name): Do not return . or .. svn path=/trunk/mono/; revision=66864
Diffstat (limited to 'eglib')
-rw-r--r--eglib/ChangeLog2
-rw-r--r--eglib/src/gdir.c8
-rw-r--r--eglib/test/dir.c7
3 files changed, 13 insertions, 4 deletions
diff --git a/eglib/ChangeLog b/eglib/ChangeLog
index daa0831c054..5839268e0a6 100644
--- a/eglib/ChangeLog
+++ b/eglib/ChangeLog
@@ -1,5 +1,7 @@
2006-10-21 Miguel de Icaza <miguel@novell.com>
+ * src/gdir.c (g_dir_read_name): Do not return . or ..
+
* src/gstr.c (g_ascii_xdigit_value): Make this into a function,
thanks to Paolo for pointing the problem with the double macro
expansion.
diff --git a/eglib/src/gdir.c b/eglib/src/gdir.c
index 97cfe5b10c2..92d99af7a44 100644
--- a/eglib/src/gdir.c
+++ b/eglib/src/gdir.c
@@ -76,9 +76,11 @@ g_dir_read_name (GDir *dir)
struct dirent *entry;
g_return_val_if_fail (dir != NULL && dir->dir != NULL, NULL);
- entry = readdir (dir->dir);
- if (entry == NULL)
- return NULL;
+ do {
+ entry = readdir (dir->dir);
+ if (entry == NULL)
+ return NULL;
+ } while ((strcmp (entry->d_name, ".") == 0) || (strcmp (entry->d_name, "..") == 0));
return entry->d_name;
#endif
diff --git a/eglib/test/dir.c b/eglib/test/dir.c
index d85a5cfd09e..c72e204d957 100644
--- a/eglib/test/dir.c
+++ b/eglib/test/dir.c
@@ -37,11 +37,16 @@ test_dir ()
return FAILED ("5 opendir should succeed");
if (error != NULL)
return FAILED ("6 got an error");
-
name = NULL;
name = g_dir_read_name (dir);
if (name == NULL)
return FAILED ("7 didn't read a file name");
+ while ((name = g_dir_read_name (dir)) != NULL) {
+ if (strcmp (name, ".") == 0)
+ return FAILED (". directory found");
+ if (strcmp (name, "..") == 0)
+ return FAILED (".. directory found");
+ }
g_dir_close (dir);
return OK;
}