summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
Diffstat (limited to 'libbb')
-rw-r--r--libbb/vfork_daemon_rexec.c5
-rw-r--r--libbb/xfuncs.c26
2 files changed, 20 insertions, 11 deletions
diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c
index 98339c9..1567d89 100644
--- a/libbb/vfork_daemon_rexec.c
+++ b/libbb/vfork_daemon_rexec.c
@@ -98,11 +98,6 @@ int wait4pid(int pid)
if (WIFSIGNALED(status))
return WTERMSIG(status) + 1000;
return 0;
- if (WIFEXITED(status))
- return WEXITSTATUS(status);
- if (WIFSIGNALED(status))
- return WTERMSIG(status) + 1000;
- return 0;
}
#if ENABLE_FEATURE_PREFER_APPLETS
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index 8dd414d..b4c059f 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -146,18 +146,32 @@ int open_or_warn(const char *pathname, int flags)
return open3_or_warn(pathname, flags, 0666);
}
-void xpipe(int filedes[2])
-{
- if (pipe(filedes))
- bb_perror_msg_and_die("can't create pipe");
-}
-
void xunlink(const char *pathname)
{
if (unlink(pathname))
bb_perror_msg_and_die("can't remove file '%s'", pathname);
}
+void xrename(const char *oldpath, const char *newpath)
+{
+ if (rename(oldpath, newpath))
+ bb_perror_msg_and_die("can't move '%s' to '%s'", oldpath, newpath);
+}
+
+int rename_or_warn(const char *oldpath, const char *newpath)
+{
+ int n = rename(oldpath, newpath);
+ if (n)
+ bb_perror_msg("can't move '%s' to '%s'", oldpath, newpath);
+ return n;
+}
+
+void xpipe(int filedes[2])
+{
+ if (pipe(filedes))
+ bb_perror_msg_and_die("can't create pipe");
+}
+
// Turn on nonblocking I/O on a fd
int ndelay_on(int fd)
{