524 sed -i usage: link("test", "test-e") Err#17 EEXIST
Reviewed by:
[email protected]
Reviewed by:
[email protected]
Reviewed by:
[email protected]
Approved by:
[email protected]
--- a/usr/src/cmd/sed/main.c Wed Dec 15 22:28:29 2010 -0800
+++ b/usr/src/cmd/sed/main.c Thu Dec 16 09:43:44 2010 -0800
@@ -336,6 +336,8 @@
if (infile != NULL) {
(void) fclose(infile);
if (*oldfname != '\0') {
+ /* if there was a backup file, remove it */
+ (void) unlink(oldfname);
if (link(fname, oldfname) != 0) {
warn("link()");
(void) unlink(tmpfname);