From 93bdadc175e95d79fd9da59958e9c8d13990282a Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 20 Nov 2015 16:57:05 +1030 Subject: [PATCH] tools/namespacize: use unlink_noerr. Signed-off-by: Rusty Russell --- tools/namespacize.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/tools/namespacize.c b/tools/namespacize.c index da2d5999..ae20e3d6 100644 --- a/tools/namespacize.c +++ b/tools/namespacize.c @@ -15,6 +15,7 @@ #include "ccan/tal/path/path.h" #include "ccan/tal/grab_file/grab_file.h" #include "ccan/err/err.h" +#include "ccan/noerr/noerr.h" #include "tools.h" static bool verbose = false; @@ -29,15 +30,6 @@ static int indent = 0; #define verbose_indent() (indent += 2) #define verbose_unindent() (indent -= 2) -static int unlink_no_errno(const char *filename) -{ - int ret = 0, serrno = errno; - if (unlink(filename) < 0) - ret = errno; - errno = serrno; - return ret; -} - static char **get_dir(const char *dir) { DIR *d; @@ -292,7 +284,7 @@ static void write_replacement_file(const char *dir, struct replace **repl) for (r = *repl; r; r = r->next) { if (write(fd,r->string,strlen(r->string)) != strlen(r->string) || write(fd, "\n", 1) != 1) { - unlink_no_errno(replname); + unlink_noerr(replname); if (errno == 0) errx(1, "Short write to %s: disk full?", replname); -- 2.39.2