Sets errno on error (== NULL), * Always ensures terminating zero */
| 644 | /* Sets errno on error (== NULL), |
| 645 | * Always ensures terminating zero */ |
| 646 | char * |
| 647 | load_file_at (int dfd, |
| 648 | const char *path) |
| 649 | { |
| 650 | int fd; |
| 651 | char *data; |
| 652 | int errsv; |
| 653 | |
| 654 | fd = TEMP_FAILURE_RETRY (openat (dfd, path, O_CLOEXEC | O_RDONLY)); |
| 655 | if (fd == -1) |
| 656 | return NULL; |
| 657 | |
| 658 | data = load_file_data (fd, NULL); |
| 659 | |
| 660 | errsv = errno; |
| 661 | close (fd); |
| 662 | errno = errsv; |
| 663 | |
| 664 | return data; |
| 665 | } |
| 666 | |
| 667 | /* Sets errno on error (< 0) */ |
| 668 | int |
no test coverage detected