aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2012-02-26 21:52:07 -0600
committerRob Landley <rob@landley.net>2012-02-26 21:52:07 -0600
commitd73c956d902fcef15ba5f8cda9becd431f042a07 (patch)
tree94f6333533615bbdc0d7e983420c3f3788aab849 /toys
parentb081ce98999111aa5518388ed7eb8e5ceb5629f9 (diff)
downloadtoybox-d73c956d902fcef15ba5f8cda9becd431f042a07.tar.gz
Teach patch -p that consecutive /// counts as one path component.
Diffstat (limited to 'toys')
-rw-r--r--toys/patch.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/toys/patch.c b/toys/patch.c
index 851f4eb6..38c71941 100644
--- a/toys/patch.c
+++ b/toys/patch.c
@@ -354,12 +354,12 @@ void patch_main(void)
}
// handle -p path truncation.
- for (i=0, s = name; *s;) {
+ for (i = 0, s = name; *s;) {
if ((toys.optflags & FLAG_PATHLEN) && TT.prefix == i) break;
- if (*(s++)=='/') {
- name = s;
- i++;
- }
+ if (*s++ != '/') continue;
+ while (*s == '/') s++;
+ name = s;
+ i++;
}
if (del) {