diff options
author | Mike Frysinger <vapier@gentoo.org> | 2006-01-29 15:44:11 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2006-01-29 15:44:11 +0000 |
commit | b956be9b7903800ac1ab6fbd635b61c4a8addaf4 (patch) | |
tree | 5a09cc70880e86d7cf34307d5ed784b66c538662 /libc/termios | |
parent | 9b9765b308a319a1a3c09fdab3629989290a0779 (diff) |
sync with glibc
Diffstat (limited to 'libc/termios')
-rw-r--r-- | libc/termios/tcgetsid.c | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/libc/termios/tcgetsid.c b/libc/termios/tcgetsid.c index cae2feac0..db13d290d 100644 --- a/libc/termios/tcgetsid.c +++ b/libc/termios/tcgetsid.c @@ -27,40 +27,42 @@ libc_hidden_proto(getsid) libc_hidden_proto(tcgetpgrp) /* Return the session ID of FD. */ -pid_t tcgetsid (int fd) +pid_t +tcgetsid (fd) + int fd; { - pid_t pgrp; - pid_t sid; + pid_t pgrp; + pid_t sid; #ifdef TIOCGSID - static int tiocgsid_does_not_work; + static int tiocgsid_does_not_work; - if (! tiocgsid_does_not_work) + if (! tiocgsid_does_not_work) { - int serrno = errno; - int sid; + int serrno = errno; + int sid; - if (ioctl (fd, TIOCGSID, &sid) < 0) + if (ioctl (fd, TIOCGSID, &sid) < 0) { - if (errno == EINVAL) + if (errno == EINVAL) { - tiocgsid_does_not_work = 1; - __set_errno(serrno); + tiocgsid_does_not_work = 1; + __set_errno (serrno); } - else - return (pid_t) -1; + else + return (pid_t) -1; } - else - return (pid_t) sid; + else + return (pid_t) sid; } #endif - pgrp = tcgetpgrp (fd); - if (pgrp == -1) - return (pid_t) -1; + pgrp = tcgetpgrp (fd); + if (pgrp == -1) + return (pid_t) -1; - sid = getsid (pgrp); - if (sid == -1 && errno == ESRCH) - __set_errno(ENOTTY); + sid = getsid (pgrp); + if (sid == -1 && errno == ESRCH) + __set_errno (ENOTTY); - return sid; + return sid; } |