From bcbec0bbf5ac1b9b1d47b6d18baebae92f6ac13e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Sun, 16 Oct 2022 19:22:05 +0800 Subject: [PATCH] fix --- file.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/file.c b/file.c index 0be747f..3ab0885 100644 --- a/file.c +++ b/file.c @@ -154,6 +154,7 @@ base16384_err_t base16384_encode_fd(int input, int output, char* encbuf, char* d static int is_next_end(FILE* fp) { int ch = fgetc(fp); + if(ch == EOF) return 0; if(ch == '=') return fgetc(fp); ungetc(ch, fp); return 0; @@ -246,13 +247,12 @@ base16384_err_t base16384_decode_fp(FILE* input, FILE* output, char* encbuf, cha } static int is_next_end_fd(int fd) { - char ch; + char ch = 0; read(fd, &ch, 1); if(ch == '=') { read(fd, &ch, 1); - return (int)ch; } - return 0; + return (int)ch; } base16384_err_t base16384_decode_fd(int input, int output, char* encbuf, char* decbuf) {