diff options
| author | Andrey A. Chernov <ache@FreeBSD.org> | 2002-05-17 12:24:19 +0000 |
|---|---|---|
| committer | Andrey A. Chernov <ache@FreeBSD.org> | 2002-05-17 12:24:19 +0000 |
| commit | 486d0387785cdabda541f64e94b2f8b2051cd24f (patch) | |
| tree | 10aab3c022785322c50f13308f97e1e56647ef5d /bin | |
| parent | 27d3ae358753b8e77b8aa5887d67b45b01d920ff (diff) | |
Notes
Diffstat (limited to 'bin')
| -rw-r--r-- | bin/cp/cp.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/bin/cp/cp.c b/bin/cp/cp.c index e803e8274a62a..e2c289a212c08 100644 --- a/bin/cp/cp.c +++ b/bin/cp/cp.c @@ -100,7 +100,7 @@ main(int argc, char *argv[]) struct stat to_stat, tmp_stat; enum op type; int Hflag, Lflag, Pflag, ch, fts_options, r, have_trailing_slash; - char *target, *s; + char *target; Hflag = Lflag = Pflag = 0; while ((ch = getopt(argc, argv, "HLPRfiprv")) != -1) @@ -179,9 +179,9 @@ main(int argc, char *argv[]) *to.p_end++ = '.'; *to.p_end = 0; } - have_trailing_slash = - ((s = strrchr(to.p_path, '/')) != NULL && s[1] == '\0'); - STRIP_TRAILING_SLASH(to); + have_trailing_slash = (to.p_end[-1] == '/'); + if (have_trailing_slash) + STRIP_TRAILING_SLASH(to); to.target_end = to.p_end; /* Set end of argument list for fts(3). */ |
