diff --git a/stepmania/PBProject/Installer/BuildInstaller.cpp b/stepmania/PBProject/Installer/BuildInstaller.cpp index b985dca1be..9a1307f2e8 100644 --- a/stepmania/PBProject/Installer/BuildInstaller.cpp +++ b/stepmania/PBProject/Installer/BuildInstaller.cpp @@ -27,7 +27,7 @@ void HandleFile(const CString& file, const CString& dir, const CString& archiveP { static bool archiveMade = false; char path[] = "/usr/bin/tar"; - char arg1[] = "-rf"; + char arg1[] = "-rvf"; char arg2[archivePath.length() + 1]; char arg3[] = "-C"; char arg4[dir.length() + 1]; @@ -43,8 +43,16 @@ void HandleFile(const CString& file, const CString& dir, const CString& archiveP strcpy(arg4, dir); strcpy(arg5, file); - if (CallTool(path, arg1, arg2, arg3, arg4, arg5, NULL)) + /*if (CallTool(path, arg1, arg2, arg3, arg4, arg5, NULL)) + exit(-10);*/ + int r; + if ((r = CallTool2(true, -1, -1, -1, path, arg1, arg2, arg3, arg4, + arg5, NULL)) != 0) + { + fprintf(stderr, "%s %s %s %s %s %s returned %d\n", + path, arg1, arg2, arg3, arg4, arg5, r); exit(-10); + } } const CString GetPath(const CString& ID) diff --git a/stepmania/PBProject/Installer/Processor.cpp b/stepmania/PBProject/Installer/Processor.cpp index 2d7974dd98..1905b64896 100644 --- a/stepmania/PBProject/Installer/Processor.cpp +++ b/stepmania/PBProject/Installer/Processor.cpp @@ -82,6 +82,9 @@ void Processor::ProcessLine(const CString& line, unsigned& nextLine) split(line, ":", parts); nextLine++; + + if (parts.size() == 0) + return; #pragma mark LABEL if (parts[0] == "LABEL") diff --git a/stepmania/PBProject/Installer/Util.cpp b/stepmania/PBProject/Installer/Util.cpp index eb45aaa816..39b2563099 100644 --- a/stepmania/PBProject/Installer/Util.cpp +++ b/stepmania/PBProject/Installer/Util.cpp @@ -36,7 +36,7 @@ bool IsADirectory(const CString& path) struct stat s; if (stat(path, &s)) return false; - return s.st_mode & S_IFDIR; + return (s.st_mode & S_IFDIR) && !(s.st_mode & S_IFLNK); } bool DoesFileExist(const CString& path) @@ -128,22 +128,24 @@ int CallTool3(bool blocking, int fd_in, int fd_out, int fd_err, const char *path case -1: /* error */ _exit(-1); case 0: /* child */ - if (fd_in > -1) + if (fd_in > -1 && fd_in != 0) + { dup2(fd_in, 0); + close(fd_in); + } - if (fd_out > -1) + if (fd_out > -1 && fd_in != 1) + { dup2(fd_out, 1); + close(fd_out); + } - if (fd_err > -1) + if (fd_err > -1 && fd_in != 2) + { dup2(fd_err, 2); + close(fd_err); + } - if (fd_err != fd_in && fd_err != fd_out) - close(fd_err); - - if (fd_out != fd_in) - close(fd_out); - - close(fd_in); execv(path, arguments); _exit(-1); } @@ -151,8 +153,9 @@ int CallTool3(bool blocking, int fd_in, int fd_out, int fd_err, const char *path if (!blocking) return 0; - int status; + int status, returnStatus; waitpid(pid, &status, 0); - return WEXITSTATUS(status); + returnStatus = WEXITSTATUS(status); + return returnStatus; }