[syslinux:elflink] extlinux: put set_attributes() back to ext2_fat_install_file().

syslinux-bot for Chen Baozi baozich at gmail.com
Tue Nov 27 12:57:05 PST 2012


Commit-ID:  3f7455cd963b4136e495bf62296b82bc2dbfc2e7
Gitweb:     http://www.syslinux.org/commit/3f7455cd963b4136e495bf62296b82bc2dbfc2e7
Author:     Chen Baozi <baozich at gmail.com>
AuthorDate: Sun, 8 Jul 2012 10:10:11 +0800
Committer:  Paulo Alcantara <pcacjr at zytor.com>
CommitDate: Sat, 21 Jul 2012 01:21:45 -0300

extlinux: put set_attributes() back to ext2_fat_install_file().

rewrite_boot_image() wraps the logic from previous
ext2_fat_install_file(). The deleted lines includes
the set_attributes(), while it is actually not
within the rewrite_boot_image().

We add set_attributes() and some helper judgement just
as what we do in xfs_install_file().

Signed-off-by: Chen Baozi <baozich at gmail.com>
Signed-off-by: Paulo Alcantara <pcacjr at zytor.com>

---
 extlinux/main.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/extlinux/main.c b/extlinux/main.c
index a9531d5..bbcc8db 100644
--- a/extlinux/main.c
+++ b/extlinux/main.c
@@ -510,6 +510,12 @@ int ext2_fat_install_file(const char *path, int devfd, struct stat *rst)
     close(fd);
 
     fd = rewrite_boot_image(devfd, file);
+    if (fd < 0)
+	goto bail;
+
+    /* Attempt to set immutable flag and remove all write access */
+    /* Only set immutable flag if file is owned by root */
+    set_attributes(fd);
 
     if (fstat(fd, rst)) {
 	perror(file);


More information about the Syslinux-commits mailing list