termux-packages/packages/busybox/networking-hostname.c.patch

23 lines
716 B
Diff

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: