Commit 7447706
committed
gh-127081: use re-entrant variants of get{proto,serv}by{name,port}
Add configure tests and defines for getservbyname_r, getservbyport_r, and
getprotobyname_r. Use these if available, otherwise fallback to the
thread-unsafe variants.
Add a unit test to exercise getprotobyname, which is currently untested.
TODO:
- Are there any platforms which define the unsafe variants but not the
re-entrant ones? If not we can simplify the #ifdef hell somewhat.
- Do the re-entrant functions have the same signature on all platforms?
- These changes follow the existing code's practice: allocate a fixed-size
(and overly large) buffer, and don't properly handle the error case if it is
too small. Should this be fixed? If so should existing code also be fixed?1 parent 815061c commit 7447706
7 files changed
Lines changed: 180 additions & 6 deletions
File tree
- Lib/test
- Misc/NEWS.d/next/Library
- Modules
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1297 | 1297 | | |
1298 | 1298 | | |
1299 | 1299 | | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
1300 | 1304 | | |
1301 | 1305 | | |
1302 | 1306 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6282 | 6282 | | |
6283 | 6283 | | |
6284 | 6284 | | |
6285 | | - | |
| 6285 | + | |
6286 | 6286 | | |
6287 | 6287 | | |
6288 | 6288 | | |
| |||
6292 | 6292 | | |
6293 | 6293 | | |
6294 | 6294 | | |
| 6295 | + | |
| 6296 | + | |
| 6297 | + | |
| 6298 | + | |
| 6299 | + | |
| 6300 | + | |
6295 | 6301 | | |
6296 | 6302 | | |
6297 | 6303 | | |
| |||
6301 | 6307 | | |
6302 | 6308 | | |
6303 | 6309 | | |
| 6310 | + | |
| 6311 | + | |
| 6312 | + | |
6304 | 6313 | | |
| 6314 | + | |
6305 | 6315 | | |
6306 | 6316 | | |
6307 | 6317 | | |
| |||
6318 | 6328 | | |
6319 | 6329 | | |
6320 | 6330 | | |
6321 | | - | |
| 6331 | + | |
6322 | 6332 | | |
6323 | 6333 | | |
6324 | 6334 | | |
| |||
6329 | 6339 | | |
6330 | 6340 | | |
6331 | 6341 | | |
| 6342 | + | |
| 6343 | + | |
| 6344 | + | |
| 6345 | + | |
| 6346 | + | |
| 6347 | + | |
6332 | 6348 | | |
6333 | 6349 | | |
6334 | 6350 | | |
| |||
6344 | 6360 | | |
6345 | 6361 | | |
6346 | 6362 | | |
| 6363 | + | |
| 6364 | + | |
| 6365 | + | |
6347 | 6366 | | |
| 6367 | + | |
6348 | 6368 | | |
6349 | 6369 | | |
6350 | 6370 | | |
| |||
6361 | 6381 | | |
6362 | 6382 | | |
6363 | 6383 | | |
6364 | | - | |
| 6384 | + | |
6365 | 6385 | | |
6366 | 6386 | | |
6367 | 6387 | | |
| |||
6371 | 6391 | | |
6372 | 6392 | | |
6373 | 6393 | | |
| 6394 | + | |
| 6395 | + | |
| 6396 | + | |
| 6397 | + | |
| 6398 | + | |
| 6399 | + | |
6374 | 6400 | | |
6375 | 6401 | | |
6376 | 6402 | | |
6377 | 6403 | | |
| 6404 | + | |
| 6405 | + | |
| 6406 | + | |
6378 | 6407 | | |
| 6408 | + | |
6379 | 6409 | | |
6380 | 6410 | | |
6381 | 6411 | | |
| |||
7428 | 7458 | | |
7429 | 7459 | | |
7430 | 7460 | | |
7431 | | - | |
| 7461 | + | |
7432 | 7462 | | |
7433 | 7463 | | |
7434 | 7464 | | |
7435 | | - | |
| 7465 | + | |
7436 | 7466 | | |
7437 | 7467 | | |
7438 | 7468 | | |
7439 | | - | |
| 7469 | + | |
7440 | 7470 | | |
7441 | 7471 | | |
7442 | 7472 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5395 | 5395 | | |
5396 | 5396 | | |
5397 | 5397 | | |
| 5398 | + | |
| 5399 | + | |
| 5400 | + | |
5398 | 5401 | | |
5399 | 5402 | | |
5400 | 5403 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
557 | 557 | | |
558 | 558 | | |
559 | 559 | | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
560 | 563 | | |
561 | 564 | | |
562 | 565 | | |
| |||
587 | 590 | | |
588 | 591 | | |
589 | 592 | | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
590 | 596 | | |
591 | 597 | | |
592 | 598 | | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
593 | 602 | | |
594 | 603 | | |
595 | 604 | | |
| |||
0 commit comments