aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-10-12 22:48:33 +0200
committerdec05eba <dec05eba@protonmail.com>2021-10-12 22:48:33 +0200
commitaa816c309b268504db04e48e5e9f328398428427 (patch)
treee8ba48c5f527491a0f2ab05a429370aac4d4ae2a /src
parentad18c8cffbecf2126b4e77ad6ec6ae78ef017e0e (diff)
misc
Diffstat (limited to 'src')
-rw-r--r--src/fileutils.c8
-rw-r--r--src/program.c7
-rw-r--r--src/rss.c2
3 files changed, 7 insertions, 10 deletions
diff --git a/src/fileutils.c b/src/fileutils.c
index 131472b..7f85ba8 100644
--- a/src/fileutils.c
+++ b/src/fileutils.c
@@ -25,9 +25,8 @@ int file_get_content(const char *filepath, char **data, long *size) {
int result = 0;
FILE *file = fopen(filepath, "rb");
if(!file) {
- int err = -errno;
/*perror(filepath);*/
- return err;
+ return -1;
}
fseek(file, 0, SEEK_END);
@@ -157,16 +156,15 @@ int file_exists(const char *path) {
int create_lock_file(const char *path) {
int fd = open(path, O_CREAT | O_EXCL | O_SYNC, 0666);
if(fd == -1)
- return errno;
+ return -1;
return close(fd);
}
int file_overwrite(const char *filepath, const char *data, size_t size) {
FILE *file = fopen(filepath, "wb");
if(!file) {
- int err = -errno;
perror(filepath);
- return err;
+ return -1;
}
unsigned long bytes_written = fwrite(data, 1, size, file);
diff --git a/src/program.c b/src/program.c
index 00f242b..56f65c1 100644
--- a/src/program.c
+++ b/src/program.c
@@ -27,9 +27,8 @@ static int program_read_output(int process_id, int read_fd, ProgramOutputCallbac
if(bytes_read == 0) {
break;
} else if(bytes_read == -1) {
- int err = errno;
- fprintf(stderr, "Failed to read from pipe, error: %s\n", strerror(err));
- return -err;
+ fprintf(stderr, "Failed to read from pipe, error: %s\n", strerror(errno));
+ return -1;
}
buffer[bytes_read] = '\0';
@@ -141,7 +140,7 @@ int program_exec_async(const char **args, int *process_id, int *stdin_file, int
pid_t pid = fork();
if(pid == -1) {
- result = -errno;
+ result = -1;
perror("failed to fork");
goto cleanup;
} else if(pid == 0) { /* child */
diff --git a/src/rss.c b/src/rss.c
index ebc0c02..0118761 100644
--- a/src/rss.c
+++ b/src/rss.c
@@ -266,7 +266,7 @@ static int get_rss_url_from_episode_info(const char *episode_name, EpisodeInfo *
printf("Filter: %s\n", generic_name);
printf("After: %s\n", episode_name);
printf("Submitter: %s\n", selected_submitter ? selected_submitter : "all submitters");
- printf("Is the tracking data above correct? (Y)es/(N)o: ");
+ printf("Is the tracking data above correct? (Y)es/No: ");
fflush(stdout);
char sresp[128];