1From edefda702d906d472ee7a675f6b506d5cfca7ac8 Mon Sep 17 00:00:00 2001 2From: Andrea Adami <andrea.adami@gmail.com> 3Date: Tue, 17 Apr 2018 13:48:25 +0200 4Subject: [PATCH] fs2dt.c: work around missing getline() 5 6This simple case can be rewrtten with fgets() 7 8Fix 9 10 fs2dt.c: In function 'dt_copy_old_root_param': 11 fs2dt.c:541:6: warning: implicit declaration of function 'getline' 12 13Upstream-Status: Inappropriate [klibc specific] 14Signed-off-by: Andrea Adami <andrea.adami@gmail.com> 15 16--- 17 kexec/fs2dt.c | 8 ++++++++ 18 1 file changed, 8 insertions(+) 19 20diff --git a/kexec/fs2dt.c b/kexec/fs2dt.c 21index 07a5e2f..d635636 100644 22--- a/kexec/fs2dt.c 23+++ b/kexec/fs2dt.c 24@@ -531,6 +531,9 @@ static void dt_copy_old_root_param(void) 25 char *last_cmdline = NULL; 26 char *p, *old_param; 27 size_t len = 0; 28+#ifdef __KLIBC__ 29+ char buf[512]; 30+#endif 31 32 strcpy(filename, pathname); 33 strcat(filename, "bootargs"); 34@@ -538,8 +541,13 @@ static void dt_copy_old_root_param(void) 35 if (!fp) 36 return; 37 38+#ifndef __KLIBC__ 39 if (getline(&last_cmdline, &len, fp) == -1) 40 die("unable to read %s\n", filename); 41+#else 42+ last_cmdline = fgets(buf, 200, fp); 43+ last_cmdline[strlen(last_cmdline) - 1] = '\0'; 44+#endif 45 46 p = strstr(last_cmdline, "root="); 47 if (p) { 48