kexec-tools_klibc-static_2.0.1: rewrite some functions for klibc compatibility (getli...
authorAndrea Adami <andrea.adami@gmail.com>
Mon, 5 Oct 2009 21:31:46 +0000 (23:31 +0200)
committerAndrea Adami <andrea.adami@gmail.com>
Mon, 5 Oct 2009 21:34:47 +0000 (23:34 +0200)
recipes/kexec/files/kexec-tools-2-klibc.patch

index 581d8a4..43b2ebc 100644 (file)
@@ -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
 ===================================================================