-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TOOLS-4438] replace tinfo.so.x LINK to dynamic library loading at runtime (dlopen) #1
[TOOLS-4438] replace tinfo.so.x LINK to dynamic library loading at runtime (dlopen) #1
Conversation
src/terminal.c
Outdated
if (dl_handle != NULL) { | ||
dlclose(dl_handle); | ||
dl_handle = NULL; | ||
} } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is one more brace "}".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your comment!
I missed it. Probably mistake from ^C/^V action.
src/terminal.c
Outdated
char *(*tgetstr) (char *id, char **area); | ||
int (*tputs) (const char *str, int affcnt, int (*putc)(int)); | ||
|
||
#define NCURSES_HIGH_VERSION 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about changing the prefix name from NCURSES to TINFOLIB ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks better.
Thank you!
src/terminal.c
Outdated
} | ||
|
||
if (dl_handle == NULL){ | ||
fprintf (stderr, "ERROR: Cannot load ncurses library.\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to tell the user the exact library name you need. So it would be nice to change the error message as the following.
"ERROR : Cannot load tinfo library. Please install tinfo library.\n"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that installing ncurses would also install tinfo.
I'll change that, thank you for your comment!
src/terminal.c
Outdated
|
||
if (dl_handle == NULL){ | ||
fprintf (stderr, "ERROR: Cannot load ncurses library.\n"); | ||
goto fail1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If an error is returned when the library cannot be loaded or the corresponding function is not found, segfault may occur due to incorrect error handling at the calling function.
It seems better to exit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hadn't considered that.
You right.
Errors related to dlopen () and dlsym () cannot be recovered, and result in coredump.
So _exit should be used.
http://jira.cubrid.org/browse/TOOLS-4438
Purpose
Implementation
Remarks