summaryrefslogtreecommitdiff
path: root/libbb/getpty.c
diff options
context:
space:
mode:
authorDenys Vlasenko2011-08-28 05:31:49 +0200
committerDenys Vlasenko2011-08-28 05:31:49 +0200
commit24915117a284c5536c9c707fc34ec9e7bf331f32 (patch)
tree2e9dd70792921647e31851667bbee13994dc6408 /libbb/getpty.c
parent1285437217a60194186b2c66a0422205b2dedd08 (diff)
downloadbusybox-24915117a284c5536c9c707fc34ec9e7bf331f32.zip
busybox-24915117a284c5536c9c707fc34ec9e7bf331f32.tar.gz
Fixes for warnings in FreeBSD build
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/getpty.c')
-rw-r--r--libbb/getpty.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/libbb/getpty.c b/libbb/getpty.c
index 6a15cff..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?) */
-#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?)");
+# 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