Allow CRLF in config files
diff mbox

Message ID 1434412418-32247-1-git-send-email-fxmulder@gmail.com
State New
Headers show

Commit Message

James Devine June 15, 2015, 11:53 p.m. UTC
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 <fxmulder@gmail.com>
---
 src/common/ConfUtils.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Gregory Farnum June 16, 2015, 9:54 a.m. UTC | #1
Can you submit this as a Github pull request?
We can take patches to userspace code over the mailing list but
they're more likely to get lost if you go that route.
-Greg

On Mon, Jun 15, 2015 at 4:53 PM, James Devine <fxmulder@gmail.com> wrote:
> 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 <fxmulder@gmail.com>
> ---
>  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<std::string> *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;
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

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<std::string> *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;