git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/3] Report symlink failures in merge-recursive

From
Alex Riesen <raa.lkml@gmail.com>
Date
Dec 5, 2008, 00:39 UTC
Message-ID
<20081205003914.GC7294@blimp.localdomain>
In-Reply-To
<20081205003546.GA7294@blimp.localdomain>
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---

I don't check for unlink success in the line above, because symlink will fail if unlink failed to cleanup the new path.

 merge-recursive.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/merge-recursive.c b/merge-recursive.c
index 0e988f2..a0c804c 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -525,7 +525,8 @@ static void update_file_flags(struct merge_options *o,
 			char *lnk = xmemdupz(buf, size);
 			safe_create_leading_directories_const(path);
 			unlink(path);
-			symlink(lnk, path);
+			if (symlink(lnk, path))
+				die("failed to symlink %s: %s", path, strerror(errno));
 			free(lnk);
 		} else
 			die("do not know what to do with %06o %s '%s'",
-- 
1.6.1.rc1.29.gb140
Previous: Alex RiesenNext: Junio C Hamano
Message 3 of 4 in “Make some of fwrite/fclose/write/close failures visible”
  1. 1/3 Make some of fwrite/fclose/write/close failures visibleAlex Riesen, Dec 5, 2008
  2. 2/3 Make chdir failures visibleAlex Riesen, Dec 5, 2008
  3. 3/3 Report symlink failures in merge-recursiveAlex Riesen, Dec 5, 2008
  4. Junio C HamanoDec 5, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.