Conversation
We were checking the result of the fscanf(3), but it was returning 1 (which is probably correct for matching the requested UUID) but we were checking it for 36, then length of the UUID. Anyway replace fscanf(3) with fread(3), this seems better as we just want to read the 36 byte UUID from the procfs file and don't need to do any parsing. Signed-off-by: Andrew Clayton <ac@sigsegv.uk>
There was a problem hiding this comment.
Pull Request Overview
This PR implements fixes for the mkdir_p() function and adds support for the Individuals Charges API. The changes include bug fixes for UUID generation and directory creation, plus comprehensive API endpoint additions.
- Fixes UUID generation to use
freadinstead offscanfand properly null-terminate the result - Corrects variable handling in
mkdir_p()function to prevent use-after-free bugs - Adds complete support for Individuals Charges API including pension charges and high income child benefit charge endpoints
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/platform/linux/gen_uuid.c | Fixes UUID generation by switching to fread and adding proper null termination |
| src/mtd.c | Fixes mkdir_p() function variable handling and pointer management |
| src/mtd-hmrc-err.c | Adds new HMRC error constants for Individuals Charges API |
| src/api_endpoints.h | Defines new API endpoints for Individuals Charges functionality |
| include/libmtdac/mtd.h | Adds public constants and enums for Individuals Charges API |
| docs/man/man3/libmtdac_mtd.h.3 | Updates documentation with new API constants |
| docs/man/man3/libmtdac.3 | Updates documentation to include Individuals Charges API |
| docs/libmtdac_mtd.h.3.rst | Updates RST documentation with new API constants |
| docs/libmtdac.3.rst | Updates RST documentation to include Individuals Charges API |
| README.rst | Updates README to list Individuals Charges API support |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This was somewhat broken, how I didn't notice sooner, I've no idea! The issue was whenever we did the fstatat(2) check and then proceeded to skip the mkdirat(2) we would also skip appending a '/' to the path so for a path like /foo/bar we'd end up with /foobar Signed-off-by: Andrew Clayton <ac@sigsegv.uk>
While it's harmless, e.g. //foo/bar, let's not... Signed-off-by: Andrew Clayton <ac@sigsegv.uk>
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Signed-off-by: Andrew Clayton <ac@sigsegv.uk>
Link: <https://developer.service.hmrc.gov.uk/api-documentation/docs/api/service/individuals-charges-api/3.0/oas/page> Signed-off-by: Andrew Clayton <ac@sigsegv.uk>
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This has some fixes for mkdir_p() and includes support for the Individuals Charges API.