# HG changeset patch
# User Pascal Bellard <pascal.bellard@slitaz.org>
# Date 1417766459 -3600
# Node ID 00ca49b1ac2ee05ca3d7f9c461ee1811a350a5dd
# Parent  1257fa601efc6e622105274bf905065f048a2036
 linux: hardlink on fifos, sockets, char & block devices and symlinks in initramfs (again)

diff -r 1257fa601efc -r 00ca49b1ac2e linux/receipt
--- a/linux/receipt	Fri Dec 05 00:27:22 2014 +0100
+++ b/linux/receipt	Fri Dec 05 09:00:59 2014 +0100
@@ -224,6 +224,7 @@
 $PACKAGE-subroot.u
 $PACKAGE-CVE-2013-2929.u
 $PACKAGE-romfs.u
+$PACKAGE-hardlinks.u
 aufs3-base.patch
 aufs3-standalone.patch
 aufs3-loopback.patch
diff -r 1257fa601efc -r 00ca49b1ac2e linux/stuff/linux-hardlinks.u
--- a/linux/stuff/linux-hardlinks.u	Fri Dec 05 00:27:22 2014 +0100
+++ b/linux/stuff/linux-hardlinks.u	Fri Dec 05 09:00:59 2014 +0100
@@ -197,7 +197,7 @@
  		kfree(vcollected);
  		eat(body_len);
  		state = SkipIt;
-@@ -353,13 +385,15 @@
+@@ -353,13 +385,18 @@
  
  static int __init do_symlink(void)
  {
@@ -206,9 +206,12 @@
 -	sys_symlink(collected + N_ALIGN(name_len), collected);
 -	sys_lchown(collected, uid, gid);
 -	do_utime(collected, mtime);
++	char c = victim[body_len];
++
 +	victim[body_len] = '\0';
 +	clean_path(vcollected, 0);
 +	sys_symlink(victim, vcollected);
++	victim[body_len] = c;
 +	sys_lchown(vcollected, uid, gid);
 +	do_utime(vcollected, mtime);
 +	make_links(vcollected);
@@ -219,7 +222,7 @@
  	return 0;
  }
  
-@@ -466,10 +500,9 @@
+@@ -466,10 +503,9 @@
  	int early_free_initrd = (buf == (char *) initrd_start);
  
  	header_buf = kmalloc(110, GFP_KERNEL);
@@ -231,7 +234,7 @@
  		panic("can't allocate buffers");
  
  	state = Start;
-@@ -524,7 +557,6 @@
+@@ -524,7 +560,6 @@
  	}
  	dir_utime();
  	kfree(name_buf);