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

klibc-bot for Baruch Siach baruch at tkos.co.il
Thu Jan 24 19:15:48 PST 2019


Commit-ID:  e3e5ce11c99ce4e5638df44ed87661945a241632
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=e3e5ce11c99ce4e5638df44ed87661945a241632
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: Fri, 25 Jan 2019 02:57:21 +0000

[klibc] histedit: fix build with musl libc

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