diff options
author | Ulf Lilleengen <lulf@FreeBSD.org> | 2008-11-23 16:44:49 +0000 |
---|---|---|
committer | Ulf Lilleengen <lulf@FreeBSD.org> | 2008-11-23 16:44:49 +0000 |
commit | 41a9dd24e46c4823d4a13051449bbfb09864a8e7 (patch) | |
tree | d92b92035ce6b8de047de5df72feb8bf736dc787 /contrib | |
parent | c978f37d889bfa0e49d7f0b4dbdcae48e2d7ebb8 (diff) | |
download | src-test2-41a9dd24e46c4823d4a13051449bbfb09864a8e7.tar.gz src-test2-41a9dd24e46c4823d4a13051449bbfb09864a8e7.zip |
Notes
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/csup/fattr.c | 16 | ||||
-rw-r--r-- | contrib/csup/updater.c | 14 |
2 files changed, 22 insertions, 8 deletions
diff --git a/contrib/csup/fattr.c b/contrib/csup/fattr.c index c8409b6ef86e..b141c2c855d4 100644 --- a/contrib/csup/fattr.c +++ b/contrib/csup/fattr.c @@ -840,6 +840,19 @@ fattr_install(struct fattr *fa, const char *topath, const char *frompath) } #endif + /* + * If it is changed from a file to a symlink, remove the file + * and create the symlink. + */ + if (inplace && (fa->type == FT_SYMLINK) && + (old->type == FT_FILE)) { + error = unlink(topath); + if (error) + goto bad; + error = symlink(fa->linktarget, topath); + if (error) + goto bad; + } /* Determine whether we need to remove the target first. */ if (!inplace && (fa->type == FT_DIRECTORY) != (old->type == FT_DIRECTORY)) { @@ -919,6 +932,9 @@ fattr_equal(const struct fattr *fa1, const struct fattr *fa2) mask = fa1->mask & fa2->mask; if (fa1->type == FT_UNKNOWN || fa2->type == FT_UNKNOWN) return (0); + if (mask & FA_FILETYPE) + if (fa1->type != fa2->type) + return (0); if (mask & FA_MODTIME) if (fa1->modtime != fa2->modtime) return (0); diff --git a/contrib/csup/updater.c b/contrib/csup/updater.c index ef2aba345dee..ea73548fc1c1 100644 --- a/contrib/csup/updater.c +++ b/contrib/csup/updater.c @@ -1255,13 +1255,13 @@ updater_diff_apply(struct updater *up, struct file_update *fup, char *state) /* Update or create a node. */ static int -updater_updatenode(struct updater *up, struct coll *coll, struct file_update *fup, char *name, - char *attr) +updater_updatenode(struct updater *up, struct coll *coll, + struct file_update *fup, char *name, char *attr) { struct fattr *fa, *fileattr; struct status *st; struct statusrec *sr; - int error, issymlink, rv; + int error, rv; sr = &fup->srbuf; st = fup->st; @@ -1270,10 +1270,8 @@ updater_updatenode(struct updater *up, struct coll *coll, struct file_update *fu if (fattr_type(fa) == FT_SYMLINK) { lprintf(1, " Symlink %s -> %s\n", name, fattr_getlinktarget(fa)); - issymlink = 1; } else { lprintf(1, " Mknod %s\n", name); - issymlink = 0; } /* Create directory. */ @@ -1281,11 +1279,11 @@ updater_updatenode(struct updater *up, struct coll *coll, struct file_update *fu if (error) return (UPDATER_ERR_PROTO); - /* If it exists, update attributes. */ + /* If it does not exist, create it. */ if (access(fup->destpath, F_OK) != 0) fattr_makenode(fa, fup->destpath); - - /* + + /* * Coming from attic? I don't think this is a problem since we have * determined attic before we call this function (Look at UpdateNode in * cvsup). |