From aa816c309b268504db04e48e5e9f328398428427 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 12 Oct 2021 22:48:33 +0200 Subject: misc --- src/fileutils.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/fileutils.c') 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); -- cgit v1.2.3