From: Reuben Thomas <rrt@sc3d.org>
Date: Tue, 16 Jan 2018 00:11:25 +0000 (+0000)
Subject: main.c: assume we have rename(3) as it’s standard since C89
X-Git-Tag: v3.7~121
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=48038e4c2b8be0133a5bf7d26c427bbe8c871640;p=recode

main.c: assume we have rename(3) as it’s standard since C89

In fact, since my recent changes, HAVE_RENAME was not being defined, so
rename was not used!
---

diff --git a/src/main.c b/src/main.c
index b161726..9a264c7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -882,17 +882,9 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"),
 
 		  if (chmod (output_name, file_stat.st_mode & 07777) < 0)
 		    error (EXIT_FAILURE, errno, "chmod (%s)", output_name);
-#if HAVE_RENAME
 		  if (rename (output_name, input_name) < 0)
 		    error (EXIT_FAILURE, errno, "rename (%s, %s)",
 			   output_name, input_name);
-#else
-		  if (link (output_name, input_name) < 0)
-		    error (EXIT_FAILURE, errno, "link (%s, %s)",
-			   output_name, input_name);
-		  if (unlink (output_name) < 0)
-		    error (EXIT_FAILURE, errno, "unlink (%s)", output_name);
-#endif
 
 		  /* Adjust the time stamp for the new file.  */