From: Sean Estabrooks <seanlkml@rogers.com>

- fix space at end of line in config files;

- add error check on put_user(); (Daniele Bellucci <bellucda@tiscali.it>)

- add missing Kconfig piece for ikconfig;


 init/Kconfig      |   25 +++++++++++++++++++++++++
 kernel/configs.c  |    3 ++-
 scripts/mkconfigs |    4 ++--
 3 files changed, 29 insertions(+), 3 deletions(-)

diff -puN init/Kconfig~ikconfig-enable init/Kconfig
--- 25/init/Kconfig~ikconfig-enable	2003-08-18 22:27:15.000000000 -0700
+++ 25-akpm/init/Kconfig	2003-08-18 22:27:15.000000000 -0700
@@ -120,6 +120,31 @@ config LOG_BUF_SHIFT
 		     13 =>  8 KB
 		     12 =>  4 KB
 
+config IKCONFIG
+	bool "Kernel .config support"
+	---help---
+	  This option enables the complete Linux kernel ".config" file
+	  contents, information on compiler used to build the kernel,
+	  kernel running when this kernel was built and kernel version
+	  from Makefile to be saved in kernel. It provides documentation
+	  of which kernel options are used in a running kernel or in an
+	  on-disk kernel.  This information can be extracted from the kernel
+	  image file with the script scripts/extract-ikconfig and used as
+	  input to rebuild the current kernel or to build another kernel.
+	  It can also be extracted from a running kernel by reading
+	  /proc/ikconfig/config and /proc/ikconfig/built_with, if enabled.
+	  /proc/ikconfig/config will list the configuration that was used
+	  to build the kernel and /proc/ikconfig/built_with will list
+	  information on the compiler and host machine that was used to
+	  build the kernel.
+
+config IKCONFIG_PROC
+	bool "Enable access to .config through /proc/ikconfig"
+	depends on IKCONFIG
+	---help---
+	  This option enables access to kernel configuration file and build
+	  information through /proc/ikconfig.
+
 
 menuconfig EMBEDDED
 	bool "Remove kernel features (for embedded systems)"
diff -puN kernel/configs.c~ikconfig-enable kernel/configs.c
--- 25/kernel/configs.c~ikconfig-enable	2003-08-18 22:27:15.000000000 -0700
+++ 25-akpm/kernel/configs.c	2003-08-18 22:27:15.000000000 -0700
@@ -64,7 +64,8 @@ ikconfig_output_current(struct file *fil
 	limit = (ikconfig_current_size > len) ? len : ikconfig_current_size;
 	for (i = file->f_pos, cnt = 0;
 	     i < ikconfig_current_size && cnt < limit; i++, cnt++) {
-		put_user(ikconfig_config[i], buf + cnt);
+		if (put_user(ikconfig_config[i], buf + cnt))
+			return -EFAULT;
 	}
 	file->f_pos = i;
 	return cnt;
diff -puN scripts/mkconfigs~ikconfig-enable scripts/mkconfigs
--- 25/scripts/mkconfigs~ikconfig-enable	2003-08-18 22:27:15.000000000 -0700
+++ 25-akpm/scripts/mkconfigs	2003-08-18 22:27:15.000000000 -0700
@@ -76,6 +76,6 @@ echo "#else"
 echo "static char *ikconfig_config __initdata __attribute__((unused)) = "
 echo "#endif"
 echo "\"CONFIG_BEGIN=n\\n\\"
-echo "`cat $config | sed 's/\"/\\\\\"/g' | grep "^#\? \?CONFIG_" | awk '{ print $0, "\\\\n\\\\" }' `"
-echo "CONFIG_END=n\";"
+echo "`cat $config | sed 's/\"/\\\\\"/g' | grep "^#\? \?CONFIG_" | awk '{ print $0 "\\\\n\\\\" }' `"
+echo "CONFIG_END=n\\n\";"
 echo "#endif /* _IKCONFIG_H */"

_