Skip to content

fix: create sdbus::Error correctly when errno is 0 - #517

Merged
sangelovic merged 1 commit into
masterfrom
fix/error-with-zero-errno
Nov 12, 2025
Merged

fix: create sdbus::Error correctly when errno is 0#517
sangelovic merged 1 commit into
masterfrom
fix/error-with-zero-errno

Conversation

@sangelovic

Copy link
Copy Markdown
Collaborator

Create an empty (invalid) sdbus::Error instance when errno is 0, instead of segfaulting or throwing an exception by std::string. Improve robustness of sdbus::createError() in general. Add more tests.

Fixes #516

Comment thread src/Error.cpp Outdated
Comment thread src/Error.cpp Outdated
Comment thread src/Error.cpp
Comment thread tests/unittests/Types_test.cpp Outdated
@sangelovic

Copy link
Copy Markdown
Collaborator Author

@JesseRiemens I addressed all your comments. Please re-review...

@JesseRiemens JesseRiemens left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I'm happy with this, looks good to me!

@sangelovic
sangelovic force-pushed the fix/error-with-zero-errno branch from f5d62be to b65d589 Compare November 12, 2025 13:56
@sangelovic
sangelovic merged commit 91f0d3f into master Nov 12, 2025
8 of 9 checks passed
@sangelovic
sangelovic deleted the fix/error-with-zero-errno branch November 12, 2025 21:43
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.

Defensive check for sd_bus_error_set_errno(…, 0) to avoid segfaults on empty error name

2 participants