REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4529
rename() call leads to a function that makes open() for source file to be renamed. The resulting file descriptor is never closed. If you have to rename a couple of files this will quickly exhaust the descriptor table. The fix is trivial - just close the fd before returning from the function. Cc: Rebecca Cran <rebe...@bsdio.com> Cc: Michael D Kinney <michael.d.kin...@intel.com> Cc: Jayaprakash N <n.jayaprak...@intel.com> Signed-off-by: Kloper Dimitry <dimitry.klo...@intel.com> --- StdLib/LibC/Uefi/Devices/UefiShell/daShell.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/StdLib/LibC/Uefi/Devices/UefiShell/daShell.c b/StdLib/LibC/Uefi/Devices/UefiShell/daShell.c index 861765e..06fcc3b 100644 --- a/StdLib/LibC/Uefi/Devices/UefiShell/daShell.c +++ b/StdLib/LibC/Uefi/Devices/UefiShell/daShell.c @@ -670,6 +670,7 @@ da_ShellRename( free(NewFileInfo); if(Status == EFI_SUCCESS) { // File has been successfully renamed. We are DONE! + close(OldFd); return 0; } errno = EFI2errno( Status ); @@ -688,6 +689,7 @@ da_ShellRename( else { errno = ENOMEM; } + close(OldFd); } return -1; } -- 2.40.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#107942): https://edk2.groups.io/g/devel/message/107942 Mute This Topic: https://groups.io/mt/100888179/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-