diff options
author | Rob Landley <rob@landley.net> | 2019-01-13 21:37:33 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2019-01-13 21:37:33 -0600 |
commit | 3fc57727741615c84f6e1e4340dfbdda467815ab (patch) | |
tree | b8f708baecd8da039b9a129276070a6f33267855 | |
parent | c68fa66380ab45957acbfb5dc3b498bb19fe880d (diff) | |
download | toybox-3fc57727741615c84f6e1e4340dfbdda467815ab.tar.gz |
Better support patching files with tabs in the name.
Patch dates are optional these days, and I should properly work back from the
end and only peel off properly formatted tab+date, but "tab followed by
digit" is probably good enough and nobody's ever complained about just tab.
And we still don't support patching filenames with newlines in them...)
-rw-r--r-- | toys/posix/patch.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/toys/posix/patch.c b/toys/posix/patch.c index f12f9183..8c93fdfd 100644 --- a/toys/posix/patch.c +++ b/toys/posix/patch.c @@ -327,7 +327,7 @@ void patch_main(void) finish_oldfile(); // Trim date from end of filename (if any). We don't care. - for (s = patchline+4; *s && *s!='\t'; s++) + for (s = patchline+4; *s && (*s!='\t' || !isdigit(s[1])); s++) if (*s=='\\' && s[1]) s++; i = atoi(s); if (i>1900 && i<=1970) *name = xstrdup("/dev/null"); |