diff --git a/dependencies/tlibc b/dependencies/tlibc index 225a48a..0b4574b 160000 --- a/dependencies/tlibc +++ b/dependencies/tlibc @@ -1 +1 @@ -Subproject commit 225a48a8d98fb5ba7edf80e882a8ae2c40852407 +Subproject commit 0b4574b53e7798c6197a2e6af6300a7e64ad7d06 diff --git a/src/cli/ClientCLI/ClientCLI.c b/src/cli/ClientCLI/ClientCLI.c index f93e634..108a35f 100644 --- a/src/cli/ClientCLI/ClientCLI.c +++ b/src/cli/ClientCLI/ClientCLI.c @@ -84,7 +84,7 @@ Result(void) ClientCLI_run(ClientCLI* self) { if(com_result.error){ Error_addCallPos(com_result.error, ErrorCallPos_here()); str e_str = Error_toStr(com_result.error); - printf(FMT_str"\n", e_str.size, e_str.data); + printf("\n"FMT_str"\n", e_str.size, e_str.data); str_free(e_str); Error_free(com_result.error); } diff --git a/src/cli/term.c b/src/cli/term.c index 9fd96aa..603d2ad 100644 --- a/src/cli/term.c +++ b/src/cli/term.c @@ -6,7 +6,12 @@ #include #include #include - #define try_zero_errno(EXPR) if((EXPR) != 0) { Return RESULT_ERROR_FMT(#EXPR " failed with errno: %s", strerror(errno)); } + #define try_zero_errno(EXPR) if((EXPR) != 0) { \ + char* errno_s = strerror_malloc(errno); \ + ResultVar(void) err = RESULT_ERROR_FMT(#EXPR " failed with errno: %s", strerror(errno)); \ + free(errno_s); \ + Return err; \ + } #endif Result(void) term_init(){ @@ -88,7 +93,9 @@ Result(void) term_getSize(TerminalSize* out) { Result(void) term_readLine(char* buf, u32 bufsize) { Deferral(1); - try_assert(fgets(buf, bufsize, stdin) != NULL); + if(fgets(buf, bufsize, stdin) == NULL){ + try_stderrcode(ferror(stdin)); + } Return RESULT_VOID; } @@ -117,8 +124,8 @@ Result(void) term_readLineHidden(char *buf, u32 bufsize) { #endif // read line try_void(term_readLine(buf, bufsize)); - fputchar('\n'); - + fputc('\n', stdout); + Return RESULT_VOID; } diff --git a/src/db/idb.c b/src/db/idb.c index abd5b32..02b8cb1 100644 --- a/src/db/idb.c +++ b/src/db/idb.c @@ -106,7 +106,7 @@ static Result(bool) Table_getDirtyBit(Table* t){ } static u32 Table_calcEncryptedRowSize(Table* t){ - return AESBlockEncryptor_calcDstSize(t->header.row_size); + return AESBlockEncryptor_calcDstSize(t->header.row_size); } static Result(void) Table_calculateRowCount(Table* t){ @@ -307,7 +307,9 @@ Result(void) idb_getRows(Table* t, u64 id, void* dst, u64 count){ // read rows from file for(u64 i = 0; i < count; i++){ void* row_ptr = (u8*)dst + row_size * i; - void* read_dst = t->header.encrypted ? t->enc_buf.data : row_ptr; + void* read_dst = t->header.encrypted + ? t->enc_buf.data + : row_ptr; try_void(file_readStructsExactly(t->table_file, read_dst, row_size_in_file, 1)); if(t->header.encrypted) { try_void( diff --git a/src/server/request_handlers/Register.c b/src/server/request_handlers/Register.c index e47b75b..4d2c48b 100644 --- a/src/server/request_handlers/Register.c +++ b/src/server/request_handlers/Register.c @@ -45,7 +45,7 @@ declare_RequestHandler(Register) if(HashMap_tryGetPtr(&server->users_name_id_map, username_str) != NULL){ try_void(sendErrorMessage_f(server, log_ctx, conn, res_head, LogSeverity_Warn, - "Username'%s' already exists", + "Username '%s' already exists", username_str.data)); Return RESULT_VOID; }