Author: stepan Date: 2006-06-05 21:40:05 +0200 (Mon, 05 Jun 2006) New Revision: 44
Modified: openbios-devel/arch/sparc32/aoutload.c openbios-devel/arch/sparc32/elfload.c openbios-devel/arch/sparc32/linux_load.c openbios-devel/arch/sparc32/loadfs.c Log: safe filedescriptors
Modified: openbios-devel/arch/sparc32/aoutload.c =================================================================== --- openbios-devel/arch/sparc32/aoutload.c 2006-06-05 19:30:59 UTC (rev 43) +++ openbios-devel/arch/sparc32/aoutload.c 2006-06-05 19:40:05 UTC (rev 44) @@ -139,5 +139,6 @@ retval = 0;
out: + file_close(); return retval; }
Modified: openbios-devel/arch/sparc32/elfload.c =================================================================== --- openbios-devel/arch/sparc32/elfload.c 2006-06-05 19:30:59 UTC (rev 43) +++ openbios-devel/arch/sparc32/elfload.c 2006-06-05 19:40:05 UTC (rev 44) @@ -127,6 +127,7 @@ } } out: + file_close(); if (buf) free(buf); return retval; @@ -402,6 +403,7 @@ retval = 0;
out: + file_close(); if (phdr) free(phdr); if (boot_notes)
Modified: openbios-devel/arch/sparc32/linux_load.c =================================================================== --- openbios-devel/arch/sparc32/linux_load.c 2006-06-05 19:30:59 UTC (rev 43) +++ openbios-devel/arch/sparc32/linux_load.c 2006-06-05 19:40:05 UTC (rev 44) @@ -589,8 +589,10 @@ return -1;
kern_addr = load_linux_header(&hdr); - if (kern_addr == 0) + if (kern_addr == 0) { + file_close(); return LOADER_NOT_SUPPORT; + }
params = phys_to_virt(LINUX_PARAM_LOC); init_linux_params(params, &hdr);
Modified: openbios-devel/arch/sparc32/loadfs.c =================================================================== --- openbios-devel/arch/sparc32/loadfs.c 2006-06-05 19:30:59 UTC (rev 43) +++ openbios-devel/arch/sparc32/loadfs.c 2006-06-05 19:40:05 UTC (rev 44) @@ -13,6 +13,15 @@ return load_fd>-1; }
+void file_close(void) +{ + if(load_fd==-1) + return; + + close_io(load_fd); + load_fd=-1; +} + int lfile_read(void *buf, unsigned long len) { int ret = 0;