* Copyright (C) 2000 Theodore Ts'o.
*
* %Begin-Header%
- * This file may be redistributed under the terms of the GNU Public
- * License.
+ * This file may be redistributed under the terms of the GNU Library
+ * General Public License, version 2.
* %End-Header%
*/
+#include "config.h"
#include <stdio.h>
#include <string.h>
#if HAVE_UNISTD_H
#if HAVE_SYS_MKDEV_H
#include <sys/mkdev.h>
#endif
+#ifdef HAVE_SYS_SYSMACROS_H
+#include <sys/sysmacros.h>
+#endif
#include "ext2_fs.h"
#include "ext2fs.h"
+#include "ext2fsP.h"
struct dir_list {
char *name;
goto skip_to_next;
if (S_ISDIR(st.st_mode))
add_to_dirlist(path, list);
- if (S_ISBLK(st.st_mode) && st.st_rdev == device) {
+ if (ext2fsP_is_disk_device(st.st_mode) &&
+ st.st_rdev == device) {
cp = malloc(strlen(path)+1);
if (!cp) {
closedir(dir);
struct dir_list *list = 0, *new_list = 0;
struct dir_list *current;
char *ret_path = 0;
+ int level = 0;
/*
* Add the starting directories to search...
if (list == 0) {
list = new_list;
new_list = 0;
+ /* Avoid infinite loop */
+ if (++level >= EXT2FS_MAX_NESTED_LINKS)
+ break;
}
}
free_dirlist(&list);