~psusi/ubuntu/saucy/grub2/fix-dmraid

« back to all changes in this revision

Viewing changes to debian/patches/ubuntu_mount_readdir_symlink_failures.patch

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-10-12 17:14:04 UTC
  • Revision ID: package-import@ubuntu.com-20121012171404-ot7x738859u6iwsb
Tags: 2.00-7ubuntu10
Ignore symlink traversal failures in grub-mount readdir (LP: #1051306).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: Ignore symlink traversal failures in grub-mount readdir
 
2
Author: Colin Watson <cjwatson@ubuntu.com>
 
3
Forwarded: Message-ID: <20121012160954.GH17188@riva.dynamic.greenend.org.uk>
 
4
Last-Update: 2012-10-12
 
5
 
 
6
Index: b/util/grub-mount.c
 
7
===================================================================
 
8
--- a/util/grub-mount.c
 
9
+++ b/util/grub-mount.c
 
10
@@ -292,7 +292,20 @@
 
11
        file = grub_file_open (tmp);
 
12
        free (tmp);
 
13
        if (! file)
 
14
-         return translate_error ();
 
15
+         {
 
16
+           /* We cannot handle symlinks properly yet, and symlinks to
 
17
+              directories will cause us to reach here.  Symlink loops or
 
18
+              dangling symlinks will also cause an error.  For the
 
19
+              meantime, while treating these as zero-length files is wrong,
 
20
+              it's better than failing the whole readdir call by returning
 
21
+              translate_error ().
 
22
+
 
23
+              Ultimately, we should be able to tell from the
 
24
+              grub_dirhook_info that this is a symlink, and fill in the
 
25
+              attributes of the symlink rather than its target.  */
 
26
+           grub_errno = GRUB_ERR_NONE;
 
27
+           return 0;
 
28
+         }
 
29
        st.st_size = file->size;
 
30
        grub_file_close (file);
 
31
       }