diff --git a/src/ChangeLog b/src/ChangeLog index 5ebb8df8c8ea022ae2fe5fc3263a14184c23f851..72ce7c1be9db23d917019d173691e58e5b03273d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2008-11-19 Larry Jones <lawrence.jones@siemens.com> + + * entries.c (WriteTag): Remove any exiting file and recreate + rather than trying to overwrite (to avoid permission problems). + + * sanity.sh (keyword-25): Protect keywords against accidental + expansion in sanity.sh itself. + 2008-11-18 Larry Jones <lawrence.jones@siemens.com> * client.c (add_prune_candidate): Strip all trailing slashes. diff --git a/src/entries.c b/src/entries.c index 0791498a83f4f773cb28405293c1c8d0c75cce13..8994d41877055612f2fdb160918e51c25cd97a73 100644 --- a/src/entries.c +++ b/src/entries.c @@ -855,21 +855,16 @@ WriteTag (const char *dir, const char *tag, const char *date, int nonbranch, tmp = xstrdup (CVSADM_TAG); + if (unlink_file (tmp) < 0 && ! existence_error (errno)) + error (1, errno, "cannot remove %s", tmp); + if (tag || date) { - fout = xfopen (tmp, "w+"); + fout = xfopen (tmp, "w"); if (tag) { - if (nonbranch) - { - if (fprintf (fout, "N%s\n", tag) < 0) - error (1, errno, "write to %s failed", tmp); - } - else - { - if (fprintf (fout, "T%s\n", tag) < 0) - error (1, errno, "write to %s failed", tmp); - } + if (fprintf (fout, "%c%s\n", nonbranch ? 'N' : 'T', tag) < 0) + error (1, errno, "write to %s failed", tmp); } else { @@ -879,9 +874,6 @@ WriteTag (const char *dir, const char *tag, const char *date, int nonbranch, if (fclose (fout) == EOF) error (1, errno, "cannot close %s", tmp); } - else - if (unlink_file (tmp) < 0 && ! existence_error (errno)) - error (1, errno, "cannot remove %s", tmp); free (tmp); #ifdef SERVER_SUPPORT if (server_active) diff --git a/src/sanity.sh b/src/sanity.sh index 0dee0dcba15271daeb94c6e6f4b94c0c35f264fc..196b75e637c794a6881a7ae9fe0efe20d2accddd 100755 --- a/src/sanity.sh +++ b/src/sanity.sh @@ -26547,9 +26547,9 @@ change" dotest_fail keyword-25 "${testcvs} diff -kk file1" \ "diff -r1\.3 file1 1c1 -< \$Name\$ +< "'\$'"Name"'\$'" --- -> \$Name: $" +> "'\$'"Name: "'\$' dotest keyword-26 "${testcvs} diff -kkv file1" "" dokeep