| Line | Source | Count |
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | | - |
| 12 | | - |
| 13 | | - |
| 14 | | - |
| 15 | | - |
| 16 | | - |
| 17 | | - |
| 18 | | - |
| 19 | | - |
| 20 | | - |
| 21 | #include <config.h> | - |
| 22 | | - |
| 23 | #include <bashtypes.h> | - |
| 24 | #if ! defined(_MINIX) && defined (HAVE_SYS_FILE_H) | - |
| 25 | # include <sys/file.h> | - |
| 26 | #endif | - |
| 27 | #include <posixstat.h> | - |
| 28 | #include <filecntl.h> | - |
| 29 | | - |
| 30 | #include <errno.h> | - |
| 31 | | - |
| 32 | #if defined (HAVE_UNISTD_H) | - |
| 33 | # include <unistd.h> | - |
| 34 | #endif | - |
| 35 | | - |
| 36 | | - |
| 37 | | - |
| 38 | #if defined (HAVE_SYS_SOCKET_H) && defined (HAVE_GETPEERNAME) && !defined (SVR4_2) | - |
| 39 | # include <sys/socket.h> | - |
| 40 | #endif | - |
| 41 | | - |
| 42 | | - |
| 43 | int | - |
| 44 | isnetconn (fd) | - |
| 45 | int fd; | - |
| 46 | { | - |
| 47 | #if defined (HAVE_SYS_SOCKET_H) && defined (HAVE_GETPEERNAME) && !defined (SVR4_2) && !defined (__BEOS__) | - |
| 48 | int rv; | - |
| 49 | socklen_t l; | - |
| 50 | struct sockaddr sa; | - |
| 51 | | - |
| 52 | l = sizeof(sa); | - |
| 53 | rv = getpeername(fd, &sa, &l); | - |
| 54 | | - |
| 55 | return ((rv < 0 && (errno == ENOTSOCK || errno == ENOTCONN || errno == EINVAL || errno == EBADF)) ? 0 : 1);executed 138 times by 1 test: return ((rv < 0 && ( (*__errno_location ()) == 88 || (*__errno_location ()) == 107 || (*__errno_location ()) == 22 || (*__errno_location ()) == 9 )) ? 0 : 1); | 138 |
| 56 | #else /* !HAVE_GETPEERNAME || SVR4_2 || __BEOS__ */ | - |
| 57 | # if defined (SVR4) || defined (SVR4_2) | - |
| 58 | | - |
| 59 | struct stat sb; | - |
| 60 | | - |
| 61 | if (isatty (fd)) | - |
| 62 | return (0); | - |
| 63 | if (fstat (fd, &sb) < 0) | - |
| 64 | return (0); | - |
| 65 | # if defined (S_ISFIFO) | - |
| 66 | if (S_ISFIFO (sb.st_mode)) | - |
| 67 | return (0); | - |
| 68 | # endif /* S_ISFIFO */ | - |
| 69 | return (S_ISCHR (sb.st_mode)); | - |
| 70 | # else /* !SVR4 && !SVR4_2 */ | - |
| 71 | # if defined (S_ISSOCK) && !defined (__BEOS__) | - |
| 72 | struct stat sb; | - |
| 73 | | - |
| 74 | if (fstat (fd, &sb) < 0) | - |
| 75 | return (0); | - |
| 76 | return (S_ISSOCK (sb.st_mode)); | - |
| 77 | # else /* !S_ISSOCK || __BEOS__ */ | - |
| 78 | return (0); | - |
| 79 | # endif /* !S_ISSOCK || __BEOS__ */ | - |
| 80 | # endif /* !SVR4 && !SVR4_2 */ | - |
| 81 | #endif /* !HAVE_GETPEERNAME || SVR4_2 || __BEOS__ */ | - |
| 82 | } | - |
| | |