524 sed -i usage: link("test", "test-e") Err#17 EEXIST
authorGarrett D'Amore <garrett@nexenta.com>
Thu, 16 Dec 2010 09:43:44 -0800
changeset 13259 8dc1138162bb
parent 13258 feaf4b4bed62
child 13260 b7552a888d42
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]
usr/src/cmd/sed/main.c
--- 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);