From 8c92c8640ad8b37230ac4883ea7c14d5af65cc7a Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Fri, 7 Jul 2017 00:30:54 +0200 Subject: [PATCH] busybox: Fix -Werror=implicit-function-declaration --- packages/busybox/coreutils-date.c.patch | 18 ++++++++++++++++++ packages/busybox/networking-hostname.c.patch | 22 ++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 packages/busybox/coreutils-date.c.patch create mode 100644 packages/busybox/networking-hostname.c.patch diff --git a/packages/busybox/coreutils-date.c.patch b/packages/busybox/coreutils-date.c.patch new file mode 100644 index 00000000..057512ef --- /dev/null +++ b/packages/busybox/coreutils-date.c.patch @@ -0,0 +1,18 @@ +diff -u -r ../busybox-1.26.2/coreutils/date.c ./coreutils/date.c +--- ../busybox-1.26.2/coreutils/date.c 2016-12-10 17:46:36.000000000 +0000 ++++ ./coreutils/date.c 2017-07-06 22:15:17.528119028 +0000 +@@ -293,9 +293,14 @@ + maybe_set_utc(opt); + + /* if setting time, set it */ ++#ifdef __ANDROID__ ++ /* stime(2) is not available on Android and is not allowed anyway. */ ++ bb_error_msg("can't set date: Operation not permitted"); ++#else + if ((opt & OPT_SET) && stime(&ts.tv_sec) < 0) { + bb_perror_msg("can't set date"); + } ++#endif + } + + /* Display output */ diff --git a/packages/busybox/networking-hostname.c.patch b/packages/busybox/networking-hostname.c.patch new file mode 100644 index 00000000..f6958d82 --- /dev/null +++ b/packages/busybox/networking-hostname.c.patch @@ -0,0 +1,22 @@ +diff -u -r ../busybox-1.26.2/networking/hostname.c ./networking/hostname.c +--- ../busybox-1.26.2/networking/hostname.c 2016-12-10 18:46:36.000000000 +0100 ++++ ./networking/hostname.c 2017-07-07 00:19:07.993535998 +0200 +@@ -58,11 +58,18 @@ + } + if (ENABLE_FEATURE_CLEAN_UP) + config_close(parser); ++#ifdef __ANDROID__ ++ } else { ++ /* sethostname() is not available on Android pre android-23 and not allowed anyway. */ ++ bb_error_msg_and_die("can't set hostname: Operation not permitted"); ++ } ++#else + } else if (sethostname(s, strlen(s))) { + // if (errno == EPERM) + // bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); + bb_perror_msg_and_die("sethostname"); + } ++#endif + } + + /* Manpage circa 2009: -- 2.11.0