X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=lib-lib%2Ffile.c;h=b51b1ffb971ba0d63ae53e1e76851f79a91fd890;hb=23e6291cb5d5b4cd2008403d8b628007fd75ff23;hp=22bb68ced722373f766d8ae68eb65600283757f5;hpb=05a3bbbe420e4afc76e0eea24ce32f859405dc4a;p=apps%2Fmadmutt.git diff --git a/lib-lib/file.c b/lib-lib/file.c index 22bb68c..b51b1ff 100644 --- a/lib-lib/file.c +++ b/lib-lib/file.c @@ -37,7 +37,6 @@ #include "mem.h" #include "str.h" #include "file.h" -#include "debug.h" #ifndef O_NOFOLLOW # define O_NOFOLLOW 0 @@ -75,7 +74,6 @@ int safe_open(const char *path, int flags) if (lstat (path, &osb) < 0 || fstat(fd, &nsb) < 0 || compare_stat(&osb, &nsb) == -1) { - debug_print(1, ("%s is a symlink!\n", path)); close(fd); return -1; } @@ -259,9 +257,9 @@ int safe_fclose(FILE **f) * If a line ends with "\", this char and the linefeed is removed, * and the next line is read too. */ -char *mutt_read_line(char *s, size_t *size, FILE * fp, int *line) +char *mutt_read_line(char *s, ssize_t *size, FILE * fp, int *line) { - size_t offset = 0; + ssize_t offset = 0; char *ch; if (!s) { @@ -310,7 +308,7 @@ int mutt_copy_stream(FILE *fin, FILE *fout) char buf[BUFSIZ]; size_t l; - while ((l = fread(buf, 1, sizeof (buf), fin)) > 0) { + while ((l = fread(buf, 1, sizeof(buf), fin)) > 0) { if (fwrite(buf, 1, l, fout) != l) return -1; } @@ -318,17 +316,16 @@ int mutt_copy_stream(FILE *fin, FILE *fout) return 0; } -int mutt_copy_bytes(FILE *in, FILE *out, size_t size) +int mutt_copy_bytes(FILE *in, FILE *out, ssize_t size) { char buf[BUFSIZ]; while (size > 0) { - size_t chunk = MIN(size, sizeof(buf)); + size_t chunk = MIN(size, ssizeof(buf)); if ((chunk = fread(buf, 1, chunk, in)) < 1) break; if (fwrite(buf, 1, chunk, out) != chunk) { - debug_print(1, ("fwrite() returned short byte count\n")); return -1; } size -= chunk;