Hello,
The attached patch intends to fix the bug by doing a special-case to avoid
searching directories if they are symbolic links.
As I don't know the qemu code much, I'm not sure this is the best fix, but I
think it's better than commenting the call to add_dir_maybe.

Comments welcome.
--- a/linux-user/path.c
+++ b/linux-user/path.c
@@ -10,6 +10,8 @@
 #include <string.h>
 #include <errno.h>
 #include <stdio.h>
+#include <sys/stat.h>
+#include <limits.h>
 #include "qemu.h"
 
 struct pathelem
@@ -58,10 +60,20 @@ static struct pathelem *add_dir_maybe(struct pathelem *path)
 
     if ((dir = opendir(path->pathname)) != NULL) {
        struct dirent *dirent;
+       struct stat dirstat;
+       char buf[PATH_MAX];
 
        while ((dirent = readdir(dir)) != NULL) {
            if (!streq(dirent->d_name,".") && !streq(dirent->d_name,"..")){
-               path = add_entry(path, dirent->d_name);
+                       if(dirent->d_type == DT_LNK) {
+                               continue;
+                       } else if(dirent->d_type == DT_UNKNOWN){
+                               snprintf(buf, sizeof(buf), "%s/%s", 
path->pathname, dirent->d_name);
+                               lstat(buf, &dirstat);
+                               if(dirstat.st_mode == S_IFLNK)
+                                       continue;
+                       }
+                       path = add_entry(path, dirent->d_name);
            }
        }
         closedir(dir);

Reply via email to