From d04e71f6a54bc77d936b2f4db649f745186fd112 Mon Sep 17 00:00:00 2001 From: Ivan Baravy Date: Thu, 1 Jul 2021 02:42:04 +0300 Subject: [PATCH] Another check of returned value. Also, add removed file. --- shell.c | 7 ++++++- test/chess_image.rgba | Bin 0 -> 256 bytes umka.asm | 10 ---------- 3 files changed, 6 insertions(+), 11 deletions(-) create mode 100644 test/chess_image.rgba diff --git a/shell.c b/shell.c index 05595be..d803163 100644 --- a/shell.c +++ b/shell.c @@ -1248,7 +1248,12 @@ shell_blit_bitmap(int argc, char **argv) { fputs(usage, fout); return; } - FILE *f = fopen(argv[1], "r"); + const char *fname = argv[1]; + FILE *f = fopen(fname, "r"); + if (!f) { + fprintf(fout, "[!] can't open file '%s': %s\n", fname, strerror(errno)); + return; + } fseek(f, 0, SEEK_END); size_t fsize = ftell(f); rewind(f); diff --git a/test/chess_image.rgba b/test/chess_image.rgba new file mode 100644 index 0000000000000000000000000000000000000000..fd1dbcfff312d4d5dab8f519d718e76174242830 GIT binary patch literal 256 acmZQzVE7LL3^-_fav(jp^ufdjyM6%GfuCUj literal 0 HcmV?d00001 diff --git a/umka.asm b/umka.asm index 11a3265..1d4d2e2 100644 --- a/umka.asm +++ b/umka.asm @@ -130,7 +130,6 @@ BTN_BUFF equ __pew15 BTN_ADDR equ __pew16 MEM_AMOUNT equ __pew17 SYS_SHUTDOWN equ __pew18 -;TASK_COUNT equ __pew19 SLOT_BASE equ __pew20 sys_proc equ __pew21 VGABasePtr equ __pew22 @@ -145,7 +144,6 @@ restore TASK_BASE,TASK_DATA,TASK_EVENT,CDDataBuf,idts,WIN_STACK,WIN_POS restore FDD_BUFF,WIN_TEMP_XY,KEY_COUNT,KEY_BUFF,BTN_COUNT,BTN_BUFF,BTN_ADDR restore MEM_AMOUNT,SYS_SHUTDOWN,SLOT_BASE,sys_proc,VGABasePtr restore HEAP_BASE -;restore TASK_COUNT purge BOOT_LO,BOOT LFB_BASE = lfb_base @@ -698,14 +696,6 @@ macro lea r, v { end if } -;macro mov r, v { -; if v eq (HEAP_BASE-OS_BASE-CLEAN_ZONE) / 4 -; int3 -; else -; mov r, v -; end if -;} - include 'kernel.asm' purge lea,add,org,mov