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