Skip to content

Commit

Permalink
Logo: fix poll() timeout or failed error when image is very large
Browse files Browse the repository at this point in the history
Fix #554
  • Loading branch information
CarterLi committed Sep 3, 2023
1 parent 4dfbc0f commit 9500ca8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/common/io/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ typedef enum FFPathType
bool ffPathExists(const char* path, FFPathType pathType);
bool ffPathExpandEnv(const char* in, FFstrbuf* out);

#define FF_IO_TERM_RESP_WAIT_MS 100 // #554

FF_C_SCANF(2, 3)
const char* ffGetTerminalResponse(const char* request, const char* format, ...);

Expand Down
2 changes: 1 addition & 1 deletion src/common/io/io_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const char* ffGetTerminalResponse(const char* request, const char* format, ...)
fflush(stdout);

//Give the terminal 35ms to respond
if(poll(&(struct pollfd) { .fd = STDIN_FILENO, .events = POLLIN }, 1, 35) <= 0)
if(poll(&(struct pollfd) { .fd = STDIN_FILENO, .events = POLLIN }, 1, FF_IO_TERM_RESP_WAIT_MS) <= 0)
{
tcsetattr(STDIN_FILENO, TCSANOW, &oldTerm);
return "poll() timeout or failed";
Expand Down
2 changes: 1 addition & 1 deletion src/common/io/io_windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ const char* ffGetTerminalResponse(const char* request, const char* format, ...)

while (true)
{
if (WaitForSingleObjectEx(hInput, 35, TRUE) != WAIT_OBJECT_0)
if (WaitForSingleObjectEx(hInput, FF_IO_TERM_RESP_WAIT_MS, TRUE) != WAIT_OBJECT_0)
{
SetConsoleMode(hInput, prev_mode);
return "WaitForSingleObject() failed or timeout";
Expand Down

0 comments on commit 9500ca8

Please sign in to comment.