X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=libbb%2Fgetpty.c;h=435e4d09f301e6e5bcefe9c81c8986728aaa3c34;hb=576b1d3c417ddea79481063401837ec0bdb91658;hp=ea653b0b6c335b0a1fdc13d8f9bd02165971828b;hpb=0ef64bdb40c54681e8dd5ab8df42ac88e4ab1d4a;p=platform%2Fupstream%2Fbusybox.git diff --git a/libbb/getpty.c b/libbb/getpty.c index ea653b0..435e4d0 100644 --- a/libbb/getpty.c +++ b/libbb/getpty.c @@ -19,20 +19,22 @@ int FAST_FUNC xgetpty(char *line) if (p > 0) { grantpt(p); /* chmod+chown corresponding slave pty */ unlockpt(p); /* (what does this do?) */ -#if 0 /* if ptsname_r is not available... */ - const char *name; - name = ptsname(p); /* find out the name of slave pty */ - if (!name) { - bb_perror_msg_and_die("ptsname error (is /dev/pts mounted?)"); +# ifndef HAVE_PTSNAME_R + { + const char *name; + name = ptsname(p); /* find out the name of slave pty */ + if (!name) { + bb_perror_msg_and_die("ptsname error (is /dev/pts mounted?)"); + } + safe_strncpy(line, name, GETPTY_BUFSIZE); } - safe_strncpy(line, name, GETPTY_BUFSIZE); -#else +# else /* find out the name of slave pty */ if (ptsname_r(p, line, GETPTY_BUFSIZE-1) != 0) { bb_perror_msg_and_die("ptsname error (is /dev/pts mounted?)"); } line[GETPTY_BUFSIZE-1] = '\0'; -#endif +# endif return p; } #else