public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Daniel Colascione (SEATTLE)" <dancol@fb.com>
To: <linux-kernel@vger.kernel.org>
Subject: Shouldn't mangle_path always mangle '\\'?
Date: Fri, 24 Apr 2015 16:16:50 -0700	[thread overview]
Message-ID: <553ACEE2.3030407@fb.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 621 bytes --]

mangle_path accepts a string listing the characters it's supposed to
escape. Some, but not all, callers put backslash in this set. Shouldn't
we be escaping '\' regardless, since it's the character used to signal
all other escapes?

diff --git a/fs/seq_file.c b/fs/seq_file.c
index 555f821..02dcd5c 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -443,7 +443,7 @@ char *mangle_path(char *s, const char *p, const char
*esc)
 		char c = *p++;
 		if (!c) {
 			return s;
-		} else if (!strchr(esc, c)) {
+		} else if (s != '\\' && !strchr(esc, c)) {
 			*s++ = c;
 		} else if (s + 4 > p) {
 			break;


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

                 reply	other threads:[~2015-04-24 23:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=553ACEE2.3030407@fb.com \
    --to=dancol@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox