REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4531

Python code opens console file descriptor and uses lseek()
with position == 0 and SEEK_CUR as
'do nothing, check console is alive' operation.

Current implementation of daConsole ignores whence argument,
this is wrong in case lseek(0, SEEK_CUR) will send cursor to (0,0).
This fix is not generic, but solves the particular situation.

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/Console/daConsole.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/StdLib/LibC/Uefi/Devices/Console/daConsole.c 
b/StdLib/LibC/Uefi/Devices/Console/daConsole.c
index 56571af..ba031d6 100644
--- a/StdLib/LibC/Uefi/Devices/Console/daConsole.c
+++ b/StdLib/LibC/Uefi/Devices/Console/daConsole.c
@@ -141,8 +141,16 @@ da_ConSeek(
     EFIerrno = RETURN_UNSUPPORTED;
     return -1;
   }
-  // Everything is OK to do the final verification and "seek".
+
   Proto = (EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)Stream->Dev;
+
+  if(Position == 0 && whence == SEEK_CUR) {
+    CursorPos.XYpos.Column  = (UINT32)Proto->Mode->CursorColumn;
+    CursorPos.XYpos.Row     = (UINT32)Proto->Mode->CursorRow;
+    return CursorPos.Offset;
+  }
+
+  // Everything is OK to do the final verification and "seek".
   CursorPos.Offset = Position;
 
   EFIerrno = Proto->SetCursorPosition(Proto,
-- 
2.40.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108016): https://edk2.groups.io/g/devel/message/108016
Mute This Topic: https://groups.io/mt/100938751/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to