aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/lib.c2
-rw-r--r--lib/lib.h1
-rw-r--r--lib/xwrap.c5
3 files changed, 7 insertions, 1 deletions
diff --git a/lib/lib.c b/lib/lib.c
index 11acba0d..ad85dc63 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -747,7 +747,7 @@ void replace_tempfile(int fdin, int fdout, char **tempname)
xclose(fdin);
}
xclose(fdout);
- rename(*tempname, temp);
+ xrename(*tempname, temp);
tempfile2zap = (char *)1;
free(*tempname);
free(temp);
diff --git a/lib/lib.h b/lib/lib.h
index 6dc2ca2b..5d806508 100644
--- a/lib/lib.h
+++ b/lib/lib.h
@@ -138,6 +138,7 @@ int xrun(char **argv);
int xpspawn(char **argv, int*pipes);
void xaccess(char *path, int flags);
void xunlink(char *path);
+void xrename(char *from, char *to);
int xtempfile(char *name, char **tempname);
int xcreate(char *path, int flags, int mode);
int xopen(char *path, int flags);
diff --git a/lib/xwrap.c b/lib/xwrap.c
index 2027069d..b2416a4e 100644
--- a/lib/xwrap.c
+++ b/lib/xwrap.c
@@ -378,6 +378,11 @@ int notstdio(int fd)
return fd;
}
+void xrename(char *from, char *to)
+{
+ if (rename(from, to)) perror_exit("rename %s -> %s", from, to);
+}
+
int xtempfile(char *name, char **tempname)
{
int fd;