Skip to content

Fixes and new API support#145

Merged
ac000 merged 5 commits intomasterfrom
ic
Sep 15, 2025
Merged

Fixes and new API support#145
ac000 merged 5 commits intomasterfrom
ic

Conversation

@ac000
Copy link
Copy Markdown
Owner

@ac000 ac000 commented Sep 15, 2025

This has some fixes for mkdir_p() and includes support for the Individuals Charges API.

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>
@ac000 ac000 requested a review from Copilot September 15, 2025 20:22
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 fread instead of fscanf and 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>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ac000 ac000 requested a review from Copilot September 15, 2025 21:08
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ac000 ac000 requested a review from Copilot September 15, 2025 21:27
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ac000 ac000 changed the title Fixes an new API support Fixes and new API support Sep 15, 2025
@ac000 ac000 requested a review from Copilot September 15, 2025 21:28
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ac000 ac000 merged commit a13c367 into master Sep 15, 2025
10 checks passed
@ac000 ac000 deleted the ic branch September 15, 2025 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants