| 1182 | ----------------------------------------------------------*/ |
| 1183 | |
| 1184 | static struct termios_list *add_port(const char *filename) |
| 1185 | { |
| 1186 | struct termios_list *index = first_tl; |
| 1187 | struct termios_list *port; |
| 1188 | |
| 1189 | ENTER("add_port"); |
| 1190 | |
| 1191 | port = calloc(1, sizeof(struct termios_list)); |
| 1192 | |
| 1193 | if (!port) |
| 1194 | { |
| 1195 | goto fail; |
| 1196 | } |
| 1197 | |
| 1198 | memset(port, 0, sizeof(struct termios_list)); |
| 1199 | |
| 1200 | port->ttyset = calloc(1, sizeof(struct termios)); |
| 1201 | |
| 1202 | if (! port->ttyset) |
| 1203 | { |
| 1204 | goto fail; |
| 1205 | } |
| 1206 | |
| 1207 | memset(port->ttyset, 0, sizeof(struct termios)); |
| 1208 | |
| 1209 | port->sstruct = calloc(1, sizeof(struct serial_struct)); |
| 1210 | |
| 1211 | if (! port->sstruct) |
| 1212 | { |
| 1213 | goto fail; |
| 1214 | } |
| 1215 | |
| 1216 | memset(port->sstruct, 0, sizeof(struct serial_struct)); |
| 1217 | port->sis = calloc(1, sizeof(struct serial_icounter_struct)); |
| 1218 | |
| 1219 | if (! port->sis) |
| 1220 | { |
| 1221 | goto fail; |
| 1222 | } |
| 1223 | |
| 1224 | memset(port->sis, 0, sizeof(struct serial_icounter_struct)); |
| 1225 | |
| 1226 | /* FIXME the async_struct is being defined by mingw32 headers? |
| 1227 | port->astruct = calloc(1, sizeof( struct async_struct ) ); |
| 1228 | if( ! port->astruct ) |
| 1229 | goto fail; |
| 1230 | memset( port->astruct, 0, sizeof( struct async_struct ) ); |
| 1231 | */ |
| 1232 | port->MSR = 0; |
| 1233 | |
| 1234 | strncpy(port->filename, filename, sizeof(port->filename) - 1); |
| 1235 | |
| 1236 | port->fd = get_free_fd(); |
| 1237 | |
| 1238 | |
| 1239 | if (!first_tl) |
| 1240 | { |
| 1241 | port->prev = NULL; |
no test coverage detected