1*26bdd445SBrad BishopFrom 14d4dbd293c75bc81a0dde6e678f9bbefb40b6f1 Mon Sep 17 00:00:00 2001 21a4b7ee2SBrad BishopFrom: Andrea Adami <andrea.adami@gmail.com> 31a4b7ee2SBrad BishopDate: Tue, 17 Apr 2018 13:48:25 +0200 41a4b7ee2SBrad BishopSubject: [PATCH] fs2dt.c: work around missing getline() 51a4b7ee2SBrad Bishop 61a4b7ee2SBrad BishopThis simple case can be rewrtten with fgets() 71a4b7ee2SBrad Bishop 81a4b7ee2SBrad BishopFix 91a4b7ee2SBrad Bishop 101a4b7ee2SBrad Bishop fs2dt.c: In function 'dt_copy_old_root_param': 111a4b7ee2SBrad Bishop fs2dt.c:541:6: warning: implicit declaration of function 'getline' 121a4b7ee2SBrad Bishop 131a4b7ee2SBrad BishopUpstream-Status: Inappropriate [klibc specific] 141a4b7ee2SBrad BishopSigned-off-by: Andrea Adami <andrea.adami@gmail.com> 151a4b7ee2SBrad Bishop 161a4b7ee2SBrad Bishop--- 171a4b7ee2SBrad Bishop kexec/fs2dt.c | 8 ++++++++ 181a4b7ee2SBrad Bishop 1 file changed, 8 insertions(+) 191a4b7ee2SBrad Bishop 201a4b7ee2SBrad Bishopdiff --git a/kexec/fs2dt.c b/kexec/fs2dt.c 211a4b7ee2SBrad Bishopindex 07a5e2f..d635636 100644 221a4b7ee2SBrad Bishop--- a/kexec/fs2dt.c 231a4b7ee2SBrad Bishop+++ b/kexec/fs2dt.c 241a4b7ee2SBrad Bishop@@ -531,6 +531,9 @@ static void dt_copy_old_root_param(void) 251a4b7ee2SBrad Bishop char *last_cmdline = NULL; 261a4b7ee2SBrad Bishop char *p, *old_param; 271a4b7ee2SBrad Bishop size_t len = 0; 281a4b7ee2SBrad Bishop+#ifdef __KLIBC__ 291a4b7ee2SBrad Bishop+ char buf[512]; 301a4b7ee2SBrad Bishop+#endif 311a4b7ee2SBrad Bishop 321a4b7ee2SBrad Bishop strcpy(filename, pathname); 331a4b7ee2SBrad Bishop strcat(filename, "bootargs"); 341a4b7ee2SBrad Bishop@@ -538,8 +541,13 @@ static void dt_copy_old_root_param(void) 351a4b7ee2SBrad Bishop if (!fp) 361a4b7ee2SBrad Bishop return; 371a4b7ee2SBrad Bishop 381a4b7ee2SBrad Bishop+#ifndef __KLIBC__ 391a4b7ee2SBrad Bishop if (getline(&last_cmdline, &len, fp) == -1) 401a4b7ee2SBrad Bishop die("unable to read %s\n", filename); 411a4b7ee2SBrad Bishop+#else 421a4b7ee2SBrad Bishop+ last_cmdline = fgets(buf, 200, fp); 431a4b7ee2SBrad Bishop+ last_cmdline[strlen(last_cmdline) - 1] = '\0'; 441a4b7ee2SBrad Bishop+#endif 451a4b7ee2SBrad Bishop 461a4b7ee2SBrad Bishop p = strstr(last_cmdline, "root="); 471a4b7ee2SBrad Bishop if (p) { 48