c - PTY/TTY -Unix: Unable to open Slave FD -


i trying create separate pty terminal. trying achieve using following code. slave fd turns out -1. can please point me doing wrong.

/* open available pty */ master_fd = posix_openpt(o_rdwr | o_noctty);        if (master_fd == -1) {     return -1; }  /* give access slave */ if (grantpt(master_fd) == -1) {                 perror("unable provice access slave");     goto error; }  /* unlock slave pty */ if (unlockpt(master_fd) == -1) {     perror("unable lock slave pty");     goto error; }  /* slave device name */ slave_device_name = ptsname(master_fd);                       if (slave_device_name == null) {     perror("unable name slave device")     goto error; }   slave_fd = open(slave_device_name, o_rdwr|o_noctty); if (slave_fd == -1) {     perror("unable retrieve fd slave");     goto error; }  error: close(master_fd); return -1; 


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo