[oe-commits] Andrea Adami : kexec-tools_klibc-static_2.0.1: rewrite some functions for klibc compatibility (getline, fscanf). Now it builds...WIP

git version control git at git.openembedded.org
Mon Oct 5 21:35:12 UTC 2009


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

Author: Andrea Adami <andrea.adami at gmail.com>
Date:   Mon Oct  5 23:31:46 2009 +0200

kexec-tools_klibc-static_2.0.1: rewrite some functions for klibc compatibility (getline, fscanf). Now it builds...WIP

---

 recipes/kexec/files/kexec-tools-2-klibc.patch |   43 +++++++++++++++++++++++-
 1 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/recipes/kexec/files/kexec-tools-2-klibc.patch b/recipes/kexec/files/kexec-tools-2-klibc.patch
index 581d8a4..43b2ebc 100644
--- a/recipes/kexec/files/kexec-tools-2-klibc.patch
+++ b/recipes/kexec/files/kexec-tools-2-klibc.patch
@@ -143,7 +143,7 @@ Index: kexec-tools-2.0.1/purgatory/string.c
 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-09-26 01:58:53.545624148 +0200
++++ kexec-tools-2.0.1/kexec/kexec.c	2009-10-05 23:19:39.000000000 +0200
 @@ -38,9 +38,9 @@
 
  #include "config.h"
@@ -157,7 +157,8 @@ Index: kexec-tools-2.0.1/kexec/kexec.c
  #include <sha256.h>
  #include "kexec.h"
  #include "kexec-syscall.h"
-@@ -555,6 +555,6 @@
+@@ -554,7 +554,7 @@
+	return buf;
  }
 
 -#if HAVE_LIBZ
@@ -165,6 +166,44 @@ 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 = NULL;
+
+	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;
+ }
+@@ -994,9 +1002,14 @@
+
+	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 */
 
 Index: kexec-tools-2.0.1/kexec/arch/arm/kexec-zImage-arm.c
 ===================================================================





More information about the Openembedded-commits mailing list