From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from arcturus.kleine-koenig.org ([2a01:4f8:d12:1f44::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aLnUE-0002Zd-Rc for barebox@lists.infradead.org; Wed, 20 Jan 2016 07:47:27 +0000 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Wed, 20 Jan 2016 08:46:50 +0100 Message-Id: <1453276010-4669-1-git-send-email-uwe@kleine-koenig.org> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH] kwboot: do a filetype check before sending the image To: barebox@lists.infradead.org U2lnbmVkLW9mZi1ieTogVXdlIEtsZWluZS1Lw7ZuaWcgPHV3ZUBrbGVpbmUta29lbmlnLm9yZz4K LS0tCiBzY3JpcHRzL2t3Ym9vdC5jIHwgNDUgKysrKysrKysrKysrKysrKysrKysrKysrKysrKysr KysrKysrKysrKysrKysrCiAxIGZpbGUgY2hhbmdlZCwgNDUgaW5zZXJ0aW9ucygrKQoKZGlmZiAt LWdpdCBhL3NjcmlwdHMva3dib290LmMgYi9zY3JpcHRzL2t3Ym9vdC5jCmluZGV4IDQ2MzI4ZDhl ZDAwNi4uNjFmODA3ZDE2M2Y3IDEwMDY0NAotLS0gYS9zY3JpcHRzL2t3Ym9vdC5jCisrKyBiL3Nj cmlwdHMva3dib290LmMKQEAgLTU0Niw2ICs1NDYsNDkgQEAgb3V0OgogCXJldHVybiByYzsKIH0K IAorc3RhdGljIHZvaWQKK2t3Ym9vdF9jaGVja19pbWFnZSh1bnNpZ25lZCBjaGFyICppbWcsIHNp emVfdCBzaXplKQoreworCXNpemVfdCBpOworCXNpemVfdCBoZWFkZXJfc2l6ZSwgaW1hZ2Vfc2l6 ZTsKKwl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