| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* Copyright 2025 Jonathan S. Arney | ||
| 2 | * | ||
| 3 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 4 | * you may not use this file except in compliance with the License. | ||
| 5 | * You may obtain a copy of the License at | ||
| 6 | * | ||
| 7 | * https://github.com/jarney/gyoji/blob/master/LICENSE | ||
| 8 | * | ||
| 9 | * Unless required by applicable law or agreed to in writing, software | ||
| 10 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 12 | * See the License for the specific language governing permissions and | ||
| 13 | * limitations under the License. | ||
| 14 | */ | ||
| 15 | #include <gyoji-misc/input-source-file.hpp> | ||
| 16 | #include <errno.h> | ||
| 17 | #include <unistd.h> | ||
| 18 | |||
| 19 | using namespace Gyoji::misc; | ||
| 20 | |||
| 21 | 288 | InputSourceFile::InputSourceFile(int _fd) | |
| 22 | 288 | : fd(_fd) | |
| 23 | 288 | {} | |
| 24 | 288 | InputSourceFile::~InputSourceFile() | |
| 25 | 288 | {} | |
| 26 | |||
| 27 | 820 | void InputSourceFile::read(char *buf, int &result, int max_size) | |
| 28 | { | ||
| 29 | 820 | errno = 0; | |
| 30 | 820 | result = (int) ::read(fd, buf, (size_t) max_size); | |
| 31 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 820 times.
|
820 | if (result == -1) { |
| 32 | ✗ | if( errno != EINTR) { | |
| 33 | ✗ | fprintf(stderr, "Fatal error reading input buffer %d\n", errno); | |
| 34 | } | ||
| 35 | } | ||
| 36 | 820 | errno = 0; | |
| 37 | 820 | } | |
| 38 |