This chunk size worked at the first try, uploading a
~100KiB file, so let's stick with it. */
- const int maxc = 64472;
+ const unsigned int maxc = 64472;
if (header && len > maxc)
return -1;
int fd;
char cwd[PATH_MAX];
char *path, *fname, *tmp;
- size_t fname_len, r;
+ size_t fname_len;
+ ssize_t r;
/* If the user provided the output directory where she wishes
to save the receipt, then we use it. Otherwise, we save
the file in the current working directory (CWD). */
}
do {
r = write(fd, buffer, len);
- } while (r != len && errno == EAGAIN);
+ } while (r < 0 && errno == EAGAIN);
if (r != len)
fprintf(stderr, "Could not write to receipt file: %s", strerror(errno));
else