Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[answerback] align implementation with POSIX-2008

- ctermid() cannot return NULL, it *can* return an empty string tho
- use our own buffer instead of the provided one. this is because some
  implementations choose to malloc the buffer! (this tool is supposed to
  be pretty speedy)
  • Loading branch information...
commit 0ab12b757eb9aab515a6d97b66c052fb93103a63 1 parent 26a9ecd
@majnemer authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 answerback.c
View
5 answerback.c
@@ -29,9 +29,10 @@ tty_reset(void)
int main()
{
- const char *cterm = ctermid(NULL);
+ char term[L_ctermid];
+ const char *cterm = ctermid(term);
- if (cterm == NULL)
+ if (cterm[0] == '\0')
{
(void)fputs("Cannot get the path to the console", stderr);
return EXIT_FAILURE;
Please sign in to comment.
Something went wrong with that request. Please try again.