~ubuntu-branches/ubuntu/utopic/busybox/utopic

« back to all changes in this revision

Viewing changes to libbb/getpty.c

  • Committer: Package Import Robot
  • Author(s): Steve Langasek
  • Date: 2012-05-01 03:35:20 UTC
  • mfrom: (2.1.29 sid)
  • Revision ID: package-import@ubuntu.com-20120501033520-3nb8wjf4bp524txp
Tags: 1:1.19.3-7ubuntu1
* Merge from Debian unstable, remaining changes:
  - [udeb] Enable chvt, killall, losetup, NFS mount, od, ping, ping6, and
    stat.
  - [deb, static] Enable CGI support for httpd.
  - Enable 'mount -f' and mount helpers for all targets.
  - Add busybox-initramfs.
  - test-bin.patch: Move test and friends to /bin.
  - static-sh-alias.patch: Add static-sh alias name for ash, and install
    /bin/static-sh symlink to busybox in busybox-static.
  - debian/patches/fix-64-bit-permissions.patch: mkdir: fix permissions
    on 64-bit platforms.  Taken from upstream.
  - Filter out -Werror=format-security from CFLAGS passed by
    dpkg-buildpackage, at least for now.
* Dropped changes, included in Debian:
  - [deb] Enable mdev.
  - Add cross-compiling support.
* Disable NFS mount in the static build; needs a newer upstream version of
  busybox for compatibility with glibc 2.15.
* Set V=1 in debian/rules, to get more meaningful build logs.
* Export the dpkg-buildflags to the environment, so we pick up hardening
  now that dpkg doesn't export them for us.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
        if (p > 0) {
20
20
                grantpt(p); /* chmod+chown corresponding slave pty */
21
21
                unlockpt(p); /* (what does this do?) */
22
 
#if 0 /* if ptsname_r is not available... */
23
 
                const char *name;
24
 
                name = ptsname(p); /* find out the name of slave pty */
25
 
                if (!name) {
26
 
                        bb_perror_msg_and_die("ptsname error (is /dev/pts mounted?)");
 
22
# ifndef HAVE_PTSNAME_R
 
23
                {
 
24
                        const char *name;
 
25
                        name = ptsname(p); /* find out the name of slave pty */
 
26
                        if (!name) {
 
27
                                bb_perror_msg_and_die("ptsname error (is /dev/pts mounted?)");
 
28
                        }
 
29
                        safe_strncpy(line, name, GETPTY_BUFSIZE);
27
30
                }
28
 
                safe_strncpy(line, name, GETPTY_BUFSIZE);
29
 
#else
 
31
# else
30
32
                /* find out the name of slave pty */
31
33
                if (ptsname_r(p, line, GETPTY_BUFSIZE-1) != 0) {
32
34
                        bb_perror_msg_and_die("ptsname error (is /dev/pts mounted?)");
33
35
                }
34
36
                line[GETPTY_BUFSIZE-1] = '\0';
35
 
#endif
 
37
# endif
36
38
                return p;
37
39
        }
38
40
#else