From patchwork Mon Jun 15 23:53:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Devine X-Patchwork-Id: 6612561 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EFB029F399 for ; Tue, 16 Jun 2015 00:12:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 03C06207D4 for ; Tue, 16 Jun 2015 00:12:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2D9E4207D1 for ; Tue, 16 Jun 2015 00:12:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752067AbbFPAML (ORCPT ); Mon, 15 Jun 2015 20:12:11 -0400 Received: from smtp-cuda2.gwtc.net ([64.251.188.104]:54374 "EHLO smtp-cuda2.e-filtering.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751885AbbFPAMJ (ORCPT ); Mon, 15 Jun 2015 20:12:09 -0400 X-Greylist: delayed 1102 seconds by postgrey-1.27 at vger.kernel.org; Mon, 15 Jun 2015 20:12:09 EDT X-ASG-Debug-ID: 1434412425-060b4953d8327090001-RKzwh1 Received: from smtp-cluster2.gwtc.net (smtp-outgoing1.gwtc.net [64.251.188.229]) by smtp-cuda2.e-filtering.net with ESMTP id 28kQy3IEu20Cj3Rg for ; Mon, 15 Jun 2015 17:53:45 -0600 (MDT) X-Barracuda-Envelope-From: fxmulder@gmail.com X-Barracuda-RBL-Trusted-Forwarder: 64.251.188.229 Received: from kernel1.gwtc.net (unknown [64.251.162.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jdevine@rapidnet.com) by smtp-cluster2.gwtc.net (Postfix) with ESMTPSA id DCC57400F6 for ; Mon, 15 Jun 2015 17:53:45 -0600 (MDT) From: James Devine X-Barracuda-Apparent-Source-IP: 64.251.162.72 X-Barracuda-RBL-IP: 64.251.162.72 To: ceph-devel@vger.kernel.org Subject: [PATCH] Allow CRLF in config files Date: Mon, 15 Jun 2015 17:53:38 -0600 X-ASG-Orig-Subj: [PATCH] Allow CRLF in config files Message-Id: <1434412418-32247-1-git-send-email-fxmulder@gmail.com> X-Mailer: git-send-email 1.9.1 X-Barracuda-Connect: smtp-outgoing1.gwtc.net[64.251.188.229] X-Barracuda-Start-Time: 1434412425 X-Barracuda-URL: http://64.251.188.104:8000/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at e-filtering.net X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=5.0 KILL_LEVEL=7.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.19880 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Change config fopen to binary mode, allowing LF and CRLF EOL characters so ceph-dokan can work with native windows configuration files going forward. The carriage return is ignored and trimmed as whitespace during parsing via isspace(). Signed-off-by: James Devine --- src/common/ConfUtils.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/ConfUtils.cc b/src/common/ConfUtils.cc index 1ae5df5..a717077 100644 --- a/src/common/ConfUtils.cc +++ b/src/common/ConfUtils.cc @@ -99,7 +99,7 @@ parse_file(const std::string &fname, std::deque *errors, int ret = 0; size_t sz; char *buf = NULL; - FILE *fp = fopen(fname.c_str(), "r"); + FILE *fp = fopen(fname.c_str(), "rb"); if (!fp) { ret = -errno; return ret;