diff options
author | David Robillard <d@drobilla.net> | 2022-11-12 17:54:22 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-11-16 10:22:55 -0500 |
commit | a2d40769d25c9495edce67be67be0ac36491ce80 (patch) | |
tree | 05eaa386cb4cfc8fb0531e940153bf3816994824 /src/filesystem.c | |
parent | 31da12734905888bb13f0ee832b62d39f2d52eb6 (diff) | |
download | lilv-a2d40769d25c9495edce67be67be0ac36491ce80.tar.gz lilv-a2d40769d25c9495edce67be67be0ac36491ce80.tar.bz2 lilv-a2d40769d25c9495edce67be67be0ac36491ce80.zip |
Use zix_copy_file()
Diffstat (limited to 'src/filesystem.c')
-rw-r--r-- | src/filesystem.c | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/src/filesystem.c b/src/filesystem.c index c0ad864..7e42dbd 100644 --- a/src/filesystem.c +++ b/src/filesystem.c @@ -25,16 +25,11 @@ #include <sys/stat.h> -#include <errno.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#ifndef PAGE_SIZE -# define PAGE_SIZE 4096 -#endif - static bool lilv_is_dir_sep(const char c) { @@ -198,45 +193,6 @@ lilv_is_directory(const char* path) } int -lilv_copy_file(const char* src, const char* dst) -{ - FILE* in = fopen(src, "r"); - if (!in) { - return errno; - } - - FILE* out = fopen(dst, "w"); - if (!out) { - fclose(in); - return errno; - } - - char* page = (char*)malloc(PAGE_SIZE); - size_t n_read = 0; - int st = 0; - while ((n_read = fread(page, 1, PAGE_SIZE, in)) > 0) { - if (fwrite(page, 1, n_read, out) != n_read) { - st = errno; - break; - } - } - - if (!st && fflush(out)) { - st = errno; - } - - if (!st && (ferror(in) || ferror(out))) { - st = EBADF; - } - - free(page); - fclose(in); - fclose(out); - - return st; -} - -int lilv_symlink(const char* oldpath, const char* newpath) { int ret = 0; |