[klibc] [klibc:update-dash] dash: histedit: fix build with musl libc

klibc-bot for Baruch Siach baruch at tkos.co.il
Sat Mar 28 14:48:56 PDT 2020


Commit-ID:  a2020fbd897e3c3d41c75294f4e43a0e07487822
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=a2020fbd897e3c3d41c75294f4e43a0e07487822
Author:     Baruch Siach <baruch at tkos.co.il>
AuthorDate: Fri, 2 Mar 2018 08:32:16 +0200
Committer:  Ben Hutchings <ben at decadent.org.uk>
CommitDate: Sat, 28 Mar 2020 21:42:54 +0000

[klibc] dash: histedit: fix build with musl libc

[ dash commit 523d24878f5fb20c03210d10a919058a43fb5c31 ]

musl libc defines the optreset BSD extension only in getopt.h. This
fixes the following build failure:

histedit.c: In function 'histcmd':
histedit.c:220:2: error: 'optreset' undeclared (first use in this function)
  optreset = 1; optind = 1; /* initialize getopt */
  ^~~~~~~~

Signed-off-by: Baruch Siach <baruch at tkos.co.il>
Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>
Signed-off-by: Ben Hutchings <ben at decadent.org.uk>

---
 usr/dash/histedit.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/usr/dash/histedit.c b/usr/dash/histedit.c
index 94465d78..f5c90aba 100644
--- a/usr/dash/histedit.c
+++ b/usr/dash/histedit.c
@@ -39,6 +39,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <getopt.h>
 /*
  * Editline and history functions (and glue).
  */


More information about the klibc mailing list