Changeset 379 for trunk/src/sh_tools.c
- Timestamp:
- Nov 28, 2011, 9:56:30 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_tools.c
r352 r379 1046 1046 int num_sel; 1047 1047 1048 struct sigaction new_act;1049 struct sigaction old_act;1050 1048 char errbuf[SH_ERRBUF_SIZE]; 1051 1049 1052 1050 SL_ENTER(_("sh_write_select")); 1053 1051 1054 /* ignore SIGPIPE (instead get EPIPE if connection is closed)1055 */1056 new_act.sa_handler = SIG_IGN;1057 sigemptyset( &new_act.sa_mask ); /* set an empty mask */1058 new_act.sa_flags = 0; /* init sa_flags */1059 sigaction (SIGPIPE, &new_act, &old_act);1060 1061 1052 FD_ZERO(&fds); 1062 1053 FD_SET(sockfd, &fds); … … 1086 1077 continue; 1087 1078 *w_error = errno; 1088 sigaction (SIGPIPE, &old_act, NULL); 1079 1089 1080 sh_error_message(*w_error, errbuf, sizeof(errbuf)); 1090 1081 sh_error_handle (SH_ERR_INFO, FIL__, __LINE__, errno, MSG_E_SUBGEN, … … 1107 1098 continue; 1108 1099 *w_error = errno; 1109 sigaction (SIGPIPE, &old_act, NULL); 1100 1110 1101 sh_error_message(*w_error, errbuf, sizeof(errbuf)); 1111 1102 sh_error_handle (SH_ERR_INFO, FIL__, __LINE__, errno, MSG_E_SUBGEN, … … 1136 1127 *w_error = 0; 1137 1128 #endif 1138 sigaction (SIGPIPE, &old_act, NULL); 1129 1139 1130 TPT(( 0, FIL__, __LINE__, _("msg=<Timeout>\n"))); 1140 1131 SL_RETURN( countbytes, _("sh_write_select")); … … 1162 1153 { 1163 1154 *w_error = errno; 1164 sigaction (SIGPIPE, &old_act, NULL); 1155 1165 1156 sh_error_message(*w_error, errbuf, sizeof(errbuf)); 1166 1157 sh_error_handle (SH_ERR_INFO, FIL__, __LINE__, errno, MSG_E_SUBGEN, … … 1174 1165 { 1175 1166 *w_error = errno; 1176 sigaction (SIGPIPE, &old_act, NULL); 1167 1177 1168 TPT(( 0, FIL__, __LINE__, _("msg=<count == 0>\n"))); 1178 1169 SL_RETURN( countbytes, _("sh_write_select")); … … 1180 1171 } 1181 1172 } 1182 1183 1184 /* restore signal handler1185 */1186 sigaction (SIGPIPE, &old_act, NULL);1187 1173 1188 1174 *w_error = 0;
Note:
See TracChangeset
for help on using the changeset viewer.