From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail.kymetacorp.com ([192.81.58.21]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aLyPd-00023V-T1 for barebox@lists.infradead.org; Wed, 20 Jan 2016 19:27:26 +0000 From: Trent Piepho Date: Wed, 20 Jan 2016 19:27:00 +0000 Message-ID: <1453318040.4474.287.camel@rtred1test09.kymeta.local> References: <1453277701-10367-1-git-send-email-uwe@kleine-koenig.org> In-Reply-To: <1453277701-10367-1-git-send-email-uwe@kleine-koenig.org> Content-Language: en-US Content-ID: <29797672C9CF5A49B42D7C8B1DCE8943@kymetacorp.com> 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: Re: [PATCH v2] kwboot: do a filetype check before sending the image To: =?utf-8?B?VXdlIEtsZWluZS1Lw7ZuaWc=?= Cc: "barebox@lists.infradead.org" T24gV2VkLCAyMDE2LTAxLTIwIGF0IDA5OjE1ICswMTAwLCBVd2UgS2xlaW5lLUvDtm5pZyB3cm90 ZToNCj4gVGhlIGltYWdlcyB0aGF0IGNhbiBiZSBzZW50IHRvIGEgTWFydmVsbCBDUFUgaGF2ZSBh IGZpeGVkIGZvcm1hdC4gRG8NCj4gc29tZSBzYW5pdHkgY2hlY2tzIGJlZm9yZSBhY3R1YWxseSBz ZW5kaW5nIGFuIGltYWdlIGZvciBlYXNpZXIgZGlhZ25vc2lzDQo+IG9mIGJyb2tlbiBmaWxlcy4N Cj4gDQo+IFNpZ25lZC1vZmYtYnk6IFV3ZSBLbGVpbmUtS8O2bmlnIDx1d2VAa2xlaW5lLWtvZW5p Zy5vcmc+DQo+IC0tLQ0KPiBDaGFuZ2VzIHNpbmNlIChpbXBsaWNpdCkgdjEsIHNlbnQgd2l0aA0K PiBN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