From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Rini Date: Thu, 18 Jul 2019 19:57:35 -0400 Subject: [U-Boot] [PATCH 2/2] tools: mkenvimage: Always consider non-regular files In-Reply-To: <20190630014501.16027-3-andre.przywara@arm.com> References: <20190630014501.16027-1-andre.przywara@arm.com> <20190630014501.16027-3-andre.przywara@arm.com> Message-ID: <20190718235735.GB20116@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Sun, Jun 30, 2019 at 02:45:01AM +0100, Andre Przywara wrote: > At the moment mkenvimage has two separate read paths: One to read from > a potential pipe, while dynamically increasing the buffer size, and a > second one using mmap(2), using the input file's size. This is > problematic for two reasons: > - The "pipe" path will be chosen if the input filename is missing or > "-". Any named, but non-regular file will use the other path, which > typically will cause mmap() to fail: > $ mkenvimage -s 256 -o out <(echo "foo=bar") > - There is no reason to have *two* ways of reading a file, since the > "pipe way" will always work, even for regular files. > > Fix this (and simplify the code on the way) by always using the method > of dynamically resizing the buffer. The existing distinction between > the two cases will merely be used to use the open() syscall or not. > > Signed-off-by: Andre Przywara Applied to u-boot/master, thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: