diff options
| -rw-r--r-- | meta-oe/recipes-core/toybox/toybox/0001-Fix-segfault-in-login.patch | 33 | ||||
| -rw-r--r-- | meta-oe/recipes-core/toybox/toybox/0002-Add-b-and-F-arguments-to-hostname.patch | 84 | ||||
| -rw-r--r-- | meta-oe/recipes-core/toybox/toybox_0.7.0.bb (renamed from meta-oe/recipes-core/toybox/toybox_0.6.0.bb) | 12 |
3 files changed, 125 insertions, 4 deletions
diff --git a/meta-oe/recipes-core/toybox/toybox/0001-Fix-segfault-in-login.patch b/meta-oe/recipes-core/toybox/toybox/0001-Fix-segfault-in-login.patch new file mode 100644 index 0000000000..939885b961 --- /dev/null +++ b/meta-oe/recipes-core/toybox/toybox/0001-Fix-segfault-in-login.patch | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | From 863b129441c12eb75d63e4f4fe9a8f7df81607fd Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Paul Barker <paul@paulbarker.me.uk> | ||
| 3 | Date: Sun, 1 May 2016 14:50:59 +0100 | ||
| 4 | Subject: [PATCH] Fix segfault in login | ||
| 5 | |||
| 6 | Fix a bug in readfileat where *plen would be corrupted if you didn't supply | ||
| 7 | your own buffer (because ibuf is 0 in that case, not a pointer to the start | ||
| 8 | of the allocated space). This caused a segfault in the 'login' program. | ||
| 9 | |||
| 10 | Partial backport of upstream commit 81f31e463bd982a8344ea8681938eb43c9114652 | ||
| 11 | |||
| 12 | Signed-off-by: Paul Barker <paul@paulbarker.me.uk> | ||
| 13 | Upstream-status: Backport | ||
| 14 | --- | ||
| 15 | lib/lib.c | 2 +- | ||
| 16 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 17 | |||
| 18 | diff --git a/lib/lib.c b/lib/lib.c | ||
| 19 | index 6559030..e5bb605 100644 | ||
| 20 | --- a/lib/lib.c | ||
| 21 | +++ b/lib/lib.c | ||
| 22 | @@ -475,7 +475,7 @@ char *readfileat(int dirfd, char *name, char *ibuf, off_t *plen) | ||
| 23 | rbuf = buf+rlen; | ||
| 24 | len -= rlen; | ||
| 25 | } | ||
| 26 | - *plen = len = rlen+(buf-ibuf); | ||
| 27 | + *plen = len = rlen+(rbuf-buf); | ||
| 28 | close(fd); | ||
| 29 | |||
| 30 | if (rlen<0) { | ||
| 31 | -- | ||
| 32 | 2.1.4 | ||
| 33 | |||
diff --git a/meta-oe/recipes-core/toybox/toybox/0002-Add-b-and-F-arguments-to-hostname.patch b/meta-oe/recipes-core/toybox/toybox/0002-Add-b-and-F-arguments-to-hostname.patch new file mode 100644 index 0000000000..e300494114 --- /dev/null +++ b/meta-oe/recipes-core/toybox/toybox/0002-Add-b-and-F-arguments-to-hostname.patch | |||
| @@ -0,0 +1,84 @@ | |||
| 1 | From 151f576ab1fba44137beaeb95620b7942662b4d3 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Paul Barker <paul@paulbarker.me.uk> | ||
| 3 | Date: Sun, 1 May 2016 15:42:57 +0100 | ||
| 4 | Subject: [PATCH] Add -b and -F arguments to hostname | ||
| 5 | |||
| 6 | These arguments are required to correctly set the hostname at boot time. | ||
| 7 | |||
| 8 | Signed-off-by: Paul Barker <paul@paulbarker.me.uk> | ||
| 9 | Upstream-status: Submitted | ||
| 10 | --- | ||
| 11 | toys/lsb/hostname.c | 42 ++++++++++++++++++++++++++++++++++++++++-- | ||
| 12 | 1 file changed, 40 insertions(+), 2 deletions(-) | ||
| 13 | |||
| 14 | diff --git a/toys/lsb/hostname.c b/toys/lsb/hostname.c | ||
| 15 | index 23467fb..ebfc803 100644 | ||
| 16 | --- a/toys/lsb/hostname.c | ||
| 17 | +++ b/toys/lsb/hostname.c | ||
| 18 | @@ -4,23 +4,61 @@ | ||
| 19 | * | ||
| 20 | * http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/hostname.html | ||
| 21 | |||
| 22 | -USE_HOSTNAME(NEWTOY(hostname, NULL, TOYFLAG_BIN)) | ||
| 23 | +USE_HOSTNAME(NEWTOY(hostname, "bF:", TOYFLAG_BIN)) | ||
| 24 | |||
| 25 | config HOSTNAME | ||
| 26 | bool "hostname" | ||
| 27 | default y | ||
| 28 | help | ||
| 29 | - usage: hostname [newname] | ||
| 30 | + usage: hostname [-b] [-F FILENAME] [newname] | ||
| 31 | |||
| 32 | Get/Set the current hostname | ||
| 33 | + | ||
| 34 | + -b Set hostname to 'localhost' if otherwise unset | ||
| 35 | + -F Set hostname to contents of FILENAME | ||
| 36 | */ | ||
| 37 | |||
| 38 | #define FOR_hostname | ||
| 39 | #include "toys.h" | ||
| 40 | |||
| 41 | +GLOBALS( | ||
| 42 | + char *fname; | ||
| 43 | +) | ||
| 44 | + | ||
| 45 | void hostname_main(void) | ||
| 46 | { | ||
| 47 | const char *hostname = toys.optargs[0]; | ||
| 48 | + | ||
| 49 | + if (toys.optflags & FLAG_F) { | ||
| 50 | + char *buf; | ||
| 51 | + if ((hostname = buf = readfile(TT.fname, 0, 0))) { | ||
| 52 | + size_t len = strlen(hostname); | ||
| 53 | + char *end = buf + len - 1; | ||
| 54 | + | ||
| 55 | + /* Trim trailing whitespace. */ | ||
| 56 | + while (len && isspace(*end)) { | ||
| 57 | + *end-- = '\0'; | ||
| 58 | + len--; | ||
| 59 | + } | ||
| 60 | + if (!len) { | ||
| 61 | + free(buf); | ||
| 62 | + hostname = NULL; | ||
| 63 | + if (!(toys.optflags & FLAG_b)) | ||
| 64 | + error_exit("empty file '%s'", TT.fname); | ||
| 65 | + } | ||
| 66 | + } else if (!(toys.optflags & FLAG_b)) | ||
| 67 | + error_exit("failed to read '%s'", TT.fname); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + if (!hostname && toys.optflags & FLAG_b) { | ||
| 71 | + /* Do nothing if hostname already set. */ | ||
| 72 | + if (gethostname(toybuf, sizeof(toybuf))) perror_exit("get failed"); | ||
| 73 | + if (strnlen(toybuf, sizeof(toybuf))) exit(0); | ||
| 74 | + | ||
| 75 | + /* Else set hostname to localhost. */ | ||
| 76 | + hostname = "localhost"; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | if (hostname) { | ||
| 80 | if (sethostname(hostname, strlen(hostname))) | ||
| 81 | perror_exit("set failed '%s'", hostname); | ||
| 82 | -- | ||
| 83 | 2.1.4 | ||
| 84 | |||
diff --git a/meta-oe/recipes-core/toybox/toybox_0.6.0.bb b/meta-oe/recipes-core/toybox/toybox_0.7.0.bb index da03200b2d..d7b469a899 100644 --- a/meta-oe/recipes-core/toybox/toybox_0.6.0.bb +++ b/meta-oe/recipes-core/toybox/toybox_0.7.0.bb | |||
| @@ -1,11 +1,15 @@ | |||
| 1 | SUMMARY = "Toybox combines common utilities together into a single executable." | 1 | SUMMARY = "Toybox combines common utilities together into a single executable." |
| 2 | HOMEPAGE = "http://www.landley.net/toybox/" | 2 | HOMEPAGE = "http://www.landley.net/toybox/" |
| 3 | DEPENDS = "attr" | ||
| 3 | 4 | ||
| 4 | SRC_URI = "http://www.landley.net/toybox/downloads/${BPN}-${PV}.tar.gz" | 5 | SRC_URI = " \ |
| 5 | 6 | http://www.landley.net/toybox/downloads/${BPN}-${PV}.tar.gz \ | |
| 6 | SRC_URI[md5sum] = "7f4a6c89e56c48e3350e611f5b36c2cf" | 7 | file://0001-Fix-segfault-in-login.patch \ |
| 7 | SRC_URI[sha256sum] = "b6e2694d19ac08f1c3416d5b2a02a31d445db2ed98dec89761430cdff2c9710d" | 8 | file://0002-Add-b-and-F-arguments-to-hostname.patch \ |
| 9 | " | ||
| 8 | 10 | ||
| 11 | SRC_URI[md5sum] = "d86c78624b47625c2f0fc64eda599443" | ||
| 12 | SRC_URI[sha256sum] = "65428816f88ad3fe92b67df86dc05427c8078fe03843b8b9715fdfa6d29c0f97" | ||
| 9 | 13 | ||
| 10 | LICENSE = "BSD-0-Clause" | 14 | LICENSE = "BSD-0-Clause" |
| 11 | LIC_FILES_CHKSUM = "file://LICENSE;md5=f0b8b3dd6431bcaa245da0a08bd0d511" | 15 | LIC_FILES_CHKSUM = "file://LICENSE;md5=f0b8b3dd6431bcaa245da0a08bd0d511" |
