diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/episode.c | 1 | ||||
-rw-r--r-- | src/fileutils.c | 2 | ||||
-rw-r--r-- | src/program.c | 11 | ||||
-rw-r--r-- | src/transmission.c | 2 |
4 files changed, 8 insertions, 8 deletions
diff --git a/src/episode.c b/src/episode.c index e89195c..67ec5ba 100644 --- a/src/episode.c +++ b/src/episode.c @@ -85,7 +85,6 @@ int episode_info_create_from_episode_name(EpisodeInfo *self, const char *episode memcpy(self->episode, episode_name_stripped + last_dash + 1, episode_len); self->episode[episode_len] = '\0'; self->episode = strip(self->episode); - episode_name_offset += episode_len + 1; } else { int episode_len = resolution_index - (last_dash + 1); self->episode = self->episode_name + episode_name_offset; diff --git a/src/fileutils.c b/src/fileutils.c index 524a603..a66bba6 100644 --- a/src/fileutils.c +++ b/src/fileutils.c @@ -104,7 +104,7 @@ int file_overwrite(const char *filepath, const char *data, size_t size) { unsigned long bytes_written = fwrite(data, 1, size, file); if(bytes_written != size) { - fprintf(stderr, "Failed to write all bytes to file %s. Expected to write %zu bytes, only wrote %zu bytes\n", filepath, size, bytes_written); + fprintf(stderr, "Failed to write all bytes to file %s. Expected to write %zu bytes, only wrote %zu bytes\n", filepath, size, (size_t)bytes_written); fclose(file); return -1; } diff --git a/src/program.c b/src/program.c index 6150616..be4f8cc 100644 --- a/src/program.c +++ b/src/program.c @@ -171,14 +171,15 @@ int program_exec_async(const char **args, int *process_id, int *stdin_file, int if(process_id) *process_id = pid; - if(stdin_file) + if(stdin_file) { close(stdin_fd[READ_END]); + *stdin_file = stdin_fd[WRITE_END]; + } - if(stdout_file) + if(stdout_file) { close(stdout_fd[WRITE_END]); - - *stdin_file = stdin_fd[WRITE_END]; - *stdout_file = stdout_fd[READ_END]; + *stdout_file = stdout_fd[READ_END]; + } return 0; } diff --git a/src/transmission.c b/src/transmission.c index 9596be0..d08c74c 100644 --- a/src/transmission.c +++ b/src/transmission.c @@ -30,7 +30,7 @@ int transmission_connect(TransmissionSession *session) { } char *session_id_end = strchr(session_id_start + 27, '\r'); - if(!session_id_start) { + if(!session_id_end) { fprintf(stderr, "Failed to find session id in transmission response\n"); result = -1; goto cleanup; |