diff options
-rw-r--r-- | lib/lib.c | 2 | ||||
-rw-r--r-- | lib/lib.h | 1 | ||||
-rw-r--r-- | lib/xwrap.c | 5 |
3 files changed, 7 insertions, 1 deletions
@@ -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); @@ -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; |