Skip to content
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

Fix errors on Ubuntu with grantpt #10

Open
weierophinney opened this issue Jul 9, 2018 · 1 comment
Open

Fix errors on Ubuntu with grantpt #10

weierophinney opened this issue Jul 9, 2018 · 1 comment

Comments

@weierophinney
Copy link

I've had a few errors while compiling on Ubuntu. 18.04 (which has glibc 1.27).

First, I had to apply the patch defined in #2 to compile at all. Without both the -02 and SVR4 flags present, compilation failed.

With that patch applied, I then saw warnings similar to the following during compilation:

ttyrec.c: In function 'getslave':
ttyrec.c:447:2: warning: implicit declaration of function 'grantpt' [-Wimplicit-function-declaration]
  grantpt( master);
  ^~~~~~~

I would receive the same warnings for usager of each of unlockpt and ptsname. Compilation would finish, but any attempt to run ttyrec would result in the following error message:

open(fd, ORDWR): Bad address

I did some sleuthing, and it appears that the grantpt et al prototypes require additional macro definitions. What I found worked was the following:

#if defined(__linux__) || defined(__GLIBC__) || defined(__GNU__)
#define _GNU_SOURCE			/* GNU glibc grantpt() prototypes */
#endif

(Those lines MUST occur before #include <stdlib.h>.)

Once those lines were in place, along with the patch from #2, compilation worked.

(I received a few additional warnings, primarily around missing sentinels in execl calls and ignoring the return value of write, but these did not adversely affect the final binary produced.)

@AdamDanischewski
Copy link

Your changes worked for me, it looks like this project is abandoned. Maybe you can fork and improve it that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants