[oe-commits] Andrea Adami : kexec-tools_2.0.1: split klibc patch creating the ' no getline, no fscanf' patch

git version control git at git.openembedded.org
Tue Oct 6 23:49:45 UTC 2009


Module: openembedded.git
Branch: org.openembedded.dev
Commit: a8d3d8a39f5941c12afe4386513722538e8fe122
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=a8d3d8a39f5941c12afe4386513722538e8fe122

Author: Andrea Adami <andrea.adami at gmail.com>
Date:   Wed Oct  7 01:43:40 2009 +0200

kexec-tools_2.0.1: split klibc patch creating the 'no getline, no fscanf' patch

---

 recipes/kexec/files/kexec-tools-2-klibc.patch  |   49 --------------------
 recipes/kexec/files/no-getline-no-fscanf.patch |   58 ++++++++++++++++++++++++
 recipes/kexec/kexec-tools2.inc                 |    1 +
 3 files changed, 59 insertions(+), 49 deletions(-)

diff --git a/recipes/kexec/files/kexec-tools-2-klibc.patch b/recipes/kexec/files/kexec-tools-2-klibc.patch
index 2196249..2008829 100644
--- a/recipes/kexec/files/kexec-tools-2-klibc.patch
+++ b/recipes/kexec/files/kexec-tools-2-klibc.patch
@@ -166,55 +166,6 @@ Index: kexec-tools-2.0.1/kexec/kexec.c
  char *slurp_decompress_file(const char *filename, off_t *r_size)
  {
 	gzFile fp;
-@@ -935,11 +935,19 @@
- {
-	int ret;
-	FILE *fp;
-+	char *endptr;
-+	char *line[3];
-
-	fp = fopen("/sys/kernel/kexec_loaded", "r");
-	if (fp == NULL)
-		return -1;
--	fscanf(fp, "%d", &ret);
-+/*	fscanf(fp, "%d", &ret); */
-+
-+	if ( NULL == fgets(line, sizeof(line), fp) ) {
-+		return -1;
-+	ret = strtol(line, &endptr, 10);
-+	}
-+
-	fclose(fp);
-	return ret;
- }
-@@ -990,17 +998,23 @@
- {
-	FILE *fp;
-	size_t len;
--	char *line = NULL;
-+	const int sizeof_line = 1024;
-+	char *line = malloc(sizeof_line); /* according to strdup() later */
-
-	fp = fopen("/proc/cmdline", "r");
-	if (!fp)
--		die("Could not read /proc/cmdline.");
--	getline(&line, &len, fp);
-+		die("Could not open /proc/cmdline.");
-+
-+	if ( NULL == fgets(line, sizeof(line), fp) ) {
-+		die("Can't read /proc/cmdline.");
-+
-+/* 	getline(&line, &len, fp); */
-	fclose(fp);
-+	}
-
-	if (line) {
-		/* strip newline */
--		*(line + strlen(line) - 1) = 0;
-+		line[strlen(line) - 1] = '\0';
-
-		remove_parameter(line, "BOOT_IMAGE");
-		if (kexec_flags & KEXEC_ON_CRASH)
 
 Index: kexec-tools-2.0.1/kexec/arch/arm/kexec-zImage-arm.c
 ===================================================================
diff --git a/recipes/kexec/files/no-getline-no-fscanf.patch b/recipes/kexec/files/no-getline-no-fscanf.patch
new file mode 100644
index 0000000..d2b803c
--- /dev/null
+++ b/recipes/kexec/files/no-getline-no-fscanf.patch
@@ -0,0 +1,58 @@
+Index: kexec-tools-2.0.1/kexec/kexec.c
+===================================================================
+--- kexec-tools-2.0.1.orig/kexec/kexec.c	2008-02-24 14:15:46.950825917 +0100
++++ kexec-tools-2.0.1/kexec/kexec.c	2009-10-06 00:37:01.000000000 +0200
+@@ -932,14 +932,22 @@
+ }
+
+ static int kexec_loaded(void)
+ {
+-	int ret;
++	int ret = 0;
+	FILE *fp;
++	char *endptr;
++	char *line[3];
+
+	fp = fopen("/sys/kernel/kexec_loaded", "r");
+	if (fp == NULL)
+		return -1;
+-	fscanf(fp, "%d", &ret);
++/*	fscanf(fp, "%d", &ret); */
++
++	if ( NULL == fgets(line, sizeof(line), fp) ) {
++		return -1;
++	ret = strtol(line, &endptr, 10);
++	}
++
+	fclose(fp);
+	return ret;
+ }
+@@ -989,17 +997,22 @@
+ char *get_command_line(void)
+ {
+	FILE *fp;
+-	size_t len;
+-	char *line = NULL;
++	const int sizeof_line = 1024;
++	char *line = malloc(sizeof_line); /* according to strdup() later */
+
+	fp = fopen("/proc/cmdline", "r");
+	if (!fp)
+-		die("Could not read /proc/cmdline.");
+-	getline(&line, &len, fp);
++		die("Could not open /proc/cmdline.");
++
++	if ( NULL == fgets(line, sizeof(line), fp) ) {
++		die("Can't read /proc/cmdline.");
++
++/* 	getline(&line, &len, fp); */
+	fclose(fp);
++	}
+
+	if (line) {
+		/* strip newline */
+-		*(line + strlen(line) - 1) = 0;
++		line[strlen(line) - 1] = '\0';
+
+		remove_parameter(line, "BOOT_IMAGE");
+		if (kexec_flags & KEXEC_ON_CRASH)
diff --git a/recipes/kexec/kexec-tools2.inc b/recipes/kexec/kexec-tools2.inc
index a4fe1b6..c34cc35 100644
--- a/recipes/kexec/kexec-tools2.inc
+++ b/recipes/kexec/kexec-tools2.inc
@@ -10,4 +10,5 @@ inherit autotools
 
 SRC_URI = "http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/kexec-tools-${PV}.tar.gz \
            file://fix-arm-arch-detection.patch;patch=1 \
+           file://no-getline-no-fscanf.patch;patch=1 \
            "





More information about the Openembedded-commits mailing list