diff options
-rw-r--r-- | src/common.c | 3 | ||||
-rw-r--r-- | src/net.c | 2 | ||||
-rw-r--r-- | src/tar.c | 3 | ||||
-rw-r--r-- | src/wine.c | 20 |
4 files changed, 7 insertions, 21 deletions
diff --git a/src/common.c b/src/common.c index 29aa3db..151e3a7 100644 --- a/src/common.c +++ b/src/common.c @@ -80,7 +80,8 @@ int makeDir(const char* path) return mkdir(path, 0755); } -int removeDir(const char *path) { +int removeDir(const char *path) +{ DIR *d = opendir(path); size_t path_len = strlen(path); int r = -1; @@ -34,7 +34,7 @@ static int xferinfo(UNUSED void *p, curl_off_t dltotal, curl_off_t dlnow, UNUSED { curl_off_t progress = 0; if (dltotal != 0) - progress = ((float)dlnow / dltotal) * 100; + progress = (dlnow * 100) / dltotal; fprintf(stderr, "\rProgress: %3" CURL_FORMAT_CURL_OFF_T "%%", progress); @@ -22,7 +22,8 @@ static int copy_data(struct archive* ar, struct archive* aw) if (r == ARCHIVE_EOF) return (ARCHIVE_OK); if (r < ARCHIVE_OK) return (r); - r = archive_write_data_block(aw, buff, size, offset); + // why does read return an int but write not? + r = (int)archive_write_data_block(aw, buff, size, offset); if (r < ARCHIVE_OK) { @@ -233,24 +233,8 @@ COMMAND(wine, run) if (isFile(winepath)) { - // quote the winepath so whitespace won't cause trouble - { - char winepathcpy[PATH_MAX] = {0}; - strncat(winepathcpy, "\"", sizeof(winepathcpy) - strlen(winepathcpy) - 1); - strncat(winepathcpy, winepath, sizeof(winepathcpy) - strlen(winepathcpy) - 1); - strncat(winepathcpy, "\"", sizeof(winepathcpy) - strlen(winepathcpy) - 1); - strncpy(winepath, winepathcpy, sizeof(winepathcpy)); - } - - for (int i = 2; i < argc; ++i) - { - // make sure the passed arguments are in quotes so spaces don't cause problems - strncat(winepath, " \"", sizeof(winepath) - strlen(winepath) - 1); - strncat(winepath, argv[i], sizeof(winepath) - strlen(winepath) - 1); - strncat(winepath, "\"", sizeof(winepath) - strlen(winepath) - 1); - } - - return system(winepath); + argv[1] = winepath; + return execvp(winepath, argv+1); } else { |