diff options
| -rw-r--r-- | meta/recipes-devtools/e2fsprogs/e2fsprogs/copy-in-create-hardlinks-with-the-correct-directory-.patch | 81 | ||||
| -rw-r--r-- | meta/recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bb | 1 |
2 files changed, 82 insertions, 0 deletions
diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs/copy-in-create-hardlinks-with-the-correct-directory-.patch b/meta/recipes-devtools/e2fsprogs/e2fsprogs/copy-in-create-hardlinks-with-the-correct-directory-.patch new file mode 100644 index 0000000000..f549693570 --- /dev/null +++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs/copy-in-create-hardlinks-with-the-correct-directory-.patch | |||
| @@ -0,0 +1,81 @@ | |||
| 1 | From 2dcf8e92bc39e05b3c799f53fe911c024aee4375 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Robert Yang <liezhi.yang@windriver.com> | ||
| 3 | Date: Fri, 23 Oct 2015 03:21:05 -0700 | ||
| 4 | Subject: [PATCH] copy-in: create hardlinks with the correct directory | ||
| 5 | filetype | ||
| 6 | |||
| 7 | When we're creating hard links via ext2fs_link, the (misnamed?) flags | ||
| 8 | argument specifies the filetype for the directory entry. This is | ||
| 9 | *derived* from i_mode, so provide a translator. Otherwise, fsck will | ||
| 10 | complain about unset file types. | ||
| 11 | |||
| 12 | Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> | ||
| 13 | Signed-off-by: Theodore Ts'o <tytso@mit.edu> | ||
| 14 | |||
| 15 | Upstream-Status: Backport | ||
| 16 | |||
| 17 | Signed-off-by: Robert Yang <liezhi.yang@windriver.com> | ||
| 18 | --- | ||
| 19 | misc/create_inode.c | 33 +++++++++++++++++++++++++++++++-- | ||
| 20 | 1 file changed, 31 insertions(+), 2 deletions(-) | ||
| 21 | |||
| 22 | diff --git a/misc/create_inode.c b/misc/create_inode.c | ||
| 23 | index fcec5aa..b8565da 100644 | ||
| 24 | --- a/misc/create_inode.c | ||
| 25 | +++ b/misc/create_inode.c | ||
| 26 | @@ -22,6 +22,33 @@ | ||
| 27 | /* For saving the hard links */ | ||
| 28 | int hdlink_cnt = HDLINK_CNT; | ||
| 29 | |||
| 30 | +static int ext2_file_type(unsigned int mode) | ||
| 31 | +{ | ||
| 32 | + if (LINUX_S_ISREG(mode)) | ||
| 33 | + return EXT2_FT_REG_FILE; | ||
| 34 | + | ||
| 35 | + if (LINUX_S_ISDIR(mode)) | ||
| 36 | + return EXT2_FT_DIR; | ||
| 37 | + | ||
| 38 | + if (LINUX_S_ISCHR(mode)) | ||
| 39 | + return EXT2_FT_CHRDEV; | ||
| 40 | + | ||
| 41 | + if (LINUX_S_ISBLK(mode)) | ||
| 42 | + return EXT2_FT_BLKDEV; | ||
| 43 | + | ||
| 44 | + if (LINUX_S_ISLNK(mode)) | ||
| 45 | + return EXT2_FT_SYMLINK; | ||
| 46 | + | ||
| 47 | + if (LINUX_S_ISFIFO(mode)) | ||
| 48 | + return EXT2_FT_FIFO; | ||
| 49 | + | ||
| 50 | + if (LINUX_S_ISSOCK(mode)) | ||
| 51 | + return EXT2_FT_SOCK; | ||
| 52 | + | ||
| 53 | + return 0; | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | + | ||
| 57 | /* Link an inode number to a directory */ | ||
| 58 | static errcode_t add_link(ext2_ino_t parent_ino, ext2_ino_t ino, const char *name) | ||
| 59 | { | ||
| 60 | @@ -34,14 +61,16 @@ static errcode_t add_link(ext2_ino_t parent_ino, ext2_ino_t ino, const char *nam | ||
| 61 | return retval; | ||
| 62 | } | ||
| 63 | |||
| 64 | - retval = ext2fs_link(current_fs, parent_ino, name, ino, inode.i_flags); | ||
| 65 | + retval = ext2fs_link(current_fs, parent_ino, name, ino, | ||
| 66 | + ext2_file_type(inode.i_mode)); | ||
| 67 | if (retval == EXT2_ET_DIR_NO_SPACE) { | ||
| 68 | retval = ext2fs_expand_dir(current_fs, parent_ino); | ||
| 69 | if (retval) { | ||
| 70 | com_err(__func__, retval, "while expanding directory"); | ||
| 71 | return retval; | ||
| 72 | } | ||
| 73 | - retval = ext2fs_link(current_fs, parent_ino, name, ino, inode.i_flags); | ||
| 74 | + retval = ext2fs_link(current_fs, parent_ino, name, ino, | ||
| 75 | + ext2_file_type(inode.i_mode)); | ||
| 76 | } | ||
| 77 | if (retval) { | ||
| 78 | com_err(__func__, retval, "while linking %s", name); | ||
| 79 | -- | ||
| 80 | 1.7.9.5 | ||
| 81 | |||
diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bb b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bb index 97e29c8916..ce7d2e8628 100644 --- a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bb +++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bb | |||
| @@ -23,6 +23,7 @@ SRC_URI += "file://acinclude.m4 \ | |||
| 23 | file://cache_inode.patch \ | 23 | file://cache_inode.patch \ |
| 24 | file://CVE-2015-0247.patch \ | 24 | file://CVE-2015-0247.patch \ |
| 25 | file://0001-libext2fs-fix-potential-buffer-overflow-in-closefs.patch \ | 25 | file://0001-libext2fs-fix-potential-buffer-overflow-in-closefs.patch \ |
| 26 | file://copy-in-create-hardlinks-with-the-correct-directory-.patch \ | ||
| 26 | " | 27 | " |
| 27 | 28 | ||
| 28 | SRC_URI[md5sum] = "3f8e41e63b432ba114b33f58674563f7" | 29 | SRC_URI[md5sum] = "3f8e41e63b432ba114b33f58674563f7" |
