* NEWS, libmisc/copydir.c: When a hardlink is detected, the
original hardlink should not be removed.
This commit is contained in:
parent
dc0947da78
commit
c3689fa60b
@ -1,3 +1,8 @@
|
|||||||
|
2010-03-31 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
|
* NEWS, libmisc/copydir.c: When a hardlink is detected, the
|
||||||
|
original hardlink should not be removed.
|
||||||
|
|
||||||
2010-03-30 Nicolas François <nicolas.francois@centraliens.net>
|
2010-03-30 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* po/POTFILES.in, libmisc/Makefile.am, lib/prototypes.h,
|
* po/POTFILES.in, libmisc/Makefile.am, lib/prototypes.h,
|
||||||
|
3
NEWS
3
NEWS
@ -33,6 +33,9 @@ shadow-4.1.4.2 -> shadow-4.1.5 UNRELEASED
|
|||||||
* Default ENV_SUPATH is /sbin:/bin:/usr/sbin:/usr/bin
|
* Default ENV_SUPATH is /sbin:/bin:/usr/sbin:/usr/bin
|
||||||
- newgrp, sg, groupmems
|
- newgrp, sg, groupmems
|
||||||
* Fix parsing of gshadow entries.
|
* Fix parsing of gshadow entries.
|
||||||
|
- useradd
|
||||||
|
* If the skeleton directory contained hardlinked files, copies of the
|
||||||
|
hardlink were removed from the skeleton directory.
|
||||||
|
|
||||||
*** translation
|
*** translation
|
||||||
* Updated Czech translation.
|
* Updated Czech translation.
|
||||||
|
@ -305,6 +305,11 @@ int copy_tree (const char *src_root, const char *dst_root,
|
|||||||
if (set_orig) {
|
if (set_orig) {
|
||||||
src_orig = NULL;
|
src_orig = NULL;
|
||||||
dst_orig = NULL;
|
dst_orig = NULL;
|
||||||
|
/* FIXME: clean links
|
||||||
|
* Since there can be hardlinks elsewhere on the device,
|
||||||
|
* we cannot check that all the hardlinks were found:
|
||||||
|
assert (NULL == links);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_SELINUX
|
#ifdef WITH_SELINUX
|
||||||
@ -312,10 +317,6 @@ int copy_tree (const char *src_root, const char *dst_root,
|
|||||||
setfscreatecon (NULL);
|
setfscreatecon (NULL);
|
||||||
#endif /* WITH_SELINUX */
|
#endif /* WITH_SELINUX */
|
||||||
|
|
||||||
/* FIXME: with the call to remove_link, we could also check that
|
|
||||||
* no links remain in links.
|
|
||||||
* assert (NULL == links); */
|
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -538,7 +539,6 @@ static int copy_symlink (const char *src, const char *dst,
|
|||||||
/* If src was a link to an entry of the src_orig directory itself,
|
/* If src was a link to an entry of the src_orig directory itself,
|
||||||
* create a link to the corresponding entry in the dst_orig
|
* create a link to the corresponding entry in the dst_orig
|
||||||
* directory.
|
* directory.
|
||||||
* FIXME: This may change a relative link to an absolute link
|
|
||||||
*/
|
*/
|
||||||
if (strncmp (oldlink, src_orig, strlen (src_orig)) == 0) {
|
if (strncmp (oldlink, src_orig, strlen (src_orig)) == 0) {
|
||||||
size_t len = strlen (dst_orig) + strlen (oldlink) - strlen (src_orig) + 1;
|
size_t len = strlen (dst_orig) + strlen (oldlink) - strlen (src_orig) + 1;
|
||||||
@ -592,20 +592,14 @@ static int copy_symlink (const char *src, const char *dst,
|
|||||||
static int copy_hardlink (const char *src, const char *dst,
|
static int copy_hardlink (const char *src, const char *dst,
|
||||||
struct link_name *lp)
|
struct link_name *lp)
|
||||||
{
|
{
|
||||||
/* TODO: selinux, ACL, Extended Attributes needed? */
|
/* FIXME: selinux, ACL, Extended Attributes needed? */
|
||||||
|
|
||||||
if (link (lp->ln_name, dst) != 0) {
|
if (link (lp->ln_name, dst) != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: why is it unlinked? This is a copy, not a move */
|
|
||||||
if (unlink (src) != 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME: idem, although it may never be used again */
|
|
||||||
/* If the file could be unlinked, decrement the links counter,
|
/* If the file could be unlinked, decrement the links counter,
|
||||||
* and delete the file if it was the last reference */
|
* and forget about this link if it was the last reference */
|
||||||
lp->ln_count--;
|
lp->ln_count--;
|
||||||
if (lp->ln_count <= 0) {
|
if (lp->ln_count <= 0) {
|
||||||
remove_link (lp);
|
remove_link (lp);
|
||||||
|
Loading…
Reference in New Issue
Block a user