diff options
| author | Reza Sabdar <Reza.Sabdar@Sun.COM> | 2010-03-29 15:59:44 -0700 |
|---|---|---|
| committer | Reza Sabdar <Reza.Sabdar@Sun.COM> | 2010-03-29 15:59:44 -0700 |
| commit | c9fd6b31f4fa1345ad799549dc0f1101b9cef127 (patch) | |
| tree | 154e1fbf2f1710cc4cfa3829f7a6ce6be3ab0227 /usr/src/cmd/ndmpd | |
| parent | 170affdd7228a2c069dff7e7ab890022ff6793d0 (diff) | |
| download | illumos-joyent-c9fd6b31f4fa1345ad799549dc0f1101b9cef127.tar.gz | |
6799726 solaris ndmp should support directory dar
Diffstat (limited to 'usr/src/cmd/ndmpd')
| -rw-r--r-- | usr/src/cmd/ndmpd/ndmp/ndmpd_tar3.c | 30 | ||||
| -rw-r--r-- | usr/src/cmd/ndmpd/tlm/tlm_restore_writer.c | 7 |
2 files changed, 25 insertions, 12 deletions
diff --git a/usr/src/cmd/ndmpd/ndmp/ndmpd_tar3.c b/usr/src/cmd/ndmpd/ndmp/ndmpd_tar3.c index 3e9c17def5..b29b5a332b 100644 --- a/usr/src/cmd/ndmpd/ndmp/ndmpd_tar3.c +++ b/usr/src/cmd/ndmpd/ndmp/ndmpd_tar3.c @@ -2731,19 +2731,27 @@ fix_nlist_v3(ndmpd_session_t *session, ndmpd_module_params_t *params, * the last component of the original path, if any * (except in V4). */ - if (session->ns_protocol_version == NDMPV4) { + if (ISDEFINED(ep->nm3_newnm)) { nm = ep->nm3_newnm; } else { - if (ISDEFINED(ep->nm3_newnm)) { - nm = ep->nm3_newnm; - } else { - /* - * Find the last component of nm3_opath. - * nm3_opath has no trailing '/'. - */ - char *p = strrchr(ep->nm3_opath, '/'); - nm = p? p : ep->nm3_opath; - } + char *p, *q; + + /* + * Find the last component of nm3_opath. + * nm3_opath has no trailing '/'. + */ + p = strrchr(ep->nm3_opath, '/'); + nm = p ? p + 1 : ep->nm3_opath; + + /* + * In DDAR the last component could + * be repeated in nm3_dpath + */ + q = strrchr(ep->nm3_dpath, '/'); + q = q ? q + 1 : ep->nm3_dpath; + if (strcmp(nm, q) == 0) + nm = NULL; + } bp = joinpath(buf, dp, nm); diff --git a/usr/src/cmd/ndmpd/tlm/tlm_restore_writer.c b/usr/src/cmd/ndmpd/tlm/tlm_restore_writer.c index a42457cfbe..966354f27f 100644 --- a/usr/src/cmd/ndmpd/tlm/tlm_restore_writer.c +++ b/usr/src/cmd/ndmpd/tlm/tlm_restore_writer.c @@ -280,6 +280,8 @@ tar_getdir(tlm_commands_t *commands, cstack_t *stp; char *bkpath; char *parentlnk; + int dir_dar = 0; + /* * The directory where temporary files may be created during a partial * non-DAR restore of hardlinks. It is intended to be initialized by @@ -825,6 +827,7 @@ tar_getdir(tlm_commands_t *commands, longname; if (is_file_wanted(file_name, sels, exls, flags, &mchtype, &pos)) { + dir_dar = DAR; nmp = rs_new_name(rnp, name, pos, file_name); if (nmp && mchtype != PM_PARENT) { (void) strlcpy(parentlnk, nmp, @@ -849,6 +852,8 @@ tar_getdir(tlm_commands_t *commands, (void) dtree_push(stp, nmp, acls); name[0] = 0; } + } else { + dir_dar = 0; } nm_end = 0; longname[0] = 0; @@ -922,7 +927,7 @@ tar_getdir(tlm_commands_t *commands, */ if (DAR && tar_hdr->th_linkflag != LF_ACL && tar_hdr->th_linkflag != LF_XATTR && - !huge_size && !is_long_name) + !huge_size && !is_long_name && !dir_dar) dar_recovered = 1; } |
