From patchwork Thu Jan 17 10:53:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 213202 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 65CB52C0086 for ; Thu, 17 Jan 2013 22:21:00 +1100 (EST) Received: from localhost ([::1]:46883 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvnWk-00017m-AW for incoming@patchwork.ozlabs.org; Thu, 17 Jan 2013 06:20:58 -0500 Received: from eggs.gnu.org ([208.118.235.92]:46397) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvnWd-00017c-51 for qemu-devel@nongnu.org; Thu, 17 Jan 2013 06:20:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TvnWb-0001gH-Fg for qemu-devel@nongnu.org; Thu, 17 Jan 2013 06:20:51 -0500 Received: from isrv.corpit.ru ([86.62.121.231]:38464) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tvn6a-0004Fs-0Q; Thu, 17 Jan 2013 05:53:56 -0500 Received: from gandalf.tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by isrv.corpit.ru (Postfix) with ESMTP id 4AFD1A1277; Thu, 17 Jan 2013 14:53:55 +0400 (MSK) Received: by gandalf.tls.msk.ru (Postfix, from userid 1000) id C6979423; Thu, 17 Jan 2013 14:53:53 +0400 (MSK) From: Michael Tokarev To: qemu-trivial@nongnu.org Date: Thu, 17 Jan 2013 14:53:52 +0400 Message-Id: <1358420032-25275-1-git-send-email-mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 1.7.10.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 86.62.121.231 Cc: TeLeMan , Michael Tokarev , qemu-devel@nongnu.org Subject: [Qemu-devel] [Trivial PATCH] acpitable: open the data file in binary mode X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org -acpitable {file|data}=file reads the content of file, but it is in binary form, so the file should be opened usin O_BINARY flag. On *nix it is a no-op, but on windows and other weird platform it is really needed. Signed-off-by: Michael Tokarev --- hw/acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/acpi.c b/hw/acpi.c index 5d521e5..49510be 100644 --- a/hw/acpi.c +++ b/hw/acpi.c @@ -115,7 +115,7 @@ int acpi_table_add(const char *t) /* now read in the data files, reallocating buffer as needed */ for (f = strtok(buf, ":"); f; f = strtok(NULL, ":")) { - int fd = open(f, O_RDONLY); + int fd = open(f, O_RDONLY | O_BINARY); if (fd < 0) { fprintf(stderr, "can't open file %s: %s\n", f, strerror(errno));