str_list_push: remove unused function
[oweals/opkg-lede.git] / libopkg / xsystem.c
index 123510f0d2b56e52143e2a19ed61eb494b59433a..b8ada59d25dbdd196181dbaa68a575b05749d6e6 100644 (file)
@@ -15,8 +15,9 @@
    General Public License for more details.
 */
 
-#include "includes.h"
+#include <sys/types.h>
 #include <sys/wait.h>
+#include <unistd.h>
 
 #include "xsystem.h"
 #include "libbb/libbb.h"
@@ -29,8 +30,7 @@
    Otherwise, the 8-bit return value of the program ala WEXITSTATUS
    as defined in <sys/wait.h>.
 */
-int
-xsystem(const char *argv[])
+int xsystem(const char *argv[])
 {
        int status;
        pid_t pid;
@@ -39,11 +39,11 @@ xsystem(const char *argv[])
 
        switch (pid) {
        case -1:
-               perror_msg("%s: %s: vfork", __FUNCTION__, argv[0]);
+               opkg_perror(ERROR, "%s: vfork", argv[0]);
                return -1;
        case 0:
                /* child */
-               execvp(argv[0], (char*const*)argv);
+               execvp(argv[0], (char *const *)argv);
                _exit(-1);
        default:
                /* parent */
@@ -51,20 +51,20 @@ xsystem(const char *argv[])
        }
 
        if (waitpid(pid, &status, 0) == -1) {
-               perror_msg("%s: %s: waitpid", __FUNCTION__, argv[0]);
+               opkg_perror(ERROR, "%s: waitpid", argv[0]);
                return -1;
        }
 
        if (WIFSIGNALED(status)) {
-               error_msg("%s: %s: Child killed by signal %d\n",
-                       __FUNCTION__, argv[0], WTERMSIG(status));
+               opkg_msg(ERROR, "%s: Child killed by signal %d.\n",
+                        argv[0], WTERMSIG(status));
                return -1;
        }
 
        if (!WIFEXITED(status)) {
                /* shouldn't happen */
-               error_msg("%s: %s: Your system is broken: got status %d "
-                       "from waitpid\n", __FUNCTION__, argv[0], status);
+               opkg_msg(ERROR, "%s: Your system is broken: got status %d "
+                        "from waitpid.\n", argv[0], status);
                return -1;
        }