lkml.org 
[lkml]   [2006]   [Feb]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] Chained CPIOs writing to the same file bug
You can chain CPIOs together for the initramfs, but if two CPIOs write
to the same file, we don't clear the first before writing the second.
If the first is larger than the second, we end up with a mash of the
two. Trivial patch below to fix this.

Signed-off-by: Michael Neuling <mikey@neuling.org>
---
init/initramfs.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6-linus/init/initramfs.c
===================================================================
--- linux-2.6-linus.orig/init/initramfs.c
+++ linux-2.6-linus/init/initramfs.c
@@ -250,7 +250,8 @@ static int __init do_name(void)
return 0;
if (S_ISREG(mode)) {
if (maybe_link() >= 0) {
- wfd = sys_open(collected, O_WRONLY|O_CREAT, mode);
+ wfd = sys_open(collected, O_WRONLY|O_CREAT|O_TRUNC,
+ mode);
if (wfd >= 0) {
sys_fchown(wfd, uid, gid);
sys_fchmod(wfd, mode);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2006-02-16 08:40    [W:0.095 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site