Skip to content

Commit a22b3b3

Browse files
committed
fix: compiler warnings in binary wrappers
Latest versions of compiler with high level of warnings enabled report unused return value with setuid() and setgid() in binary wrappers. This is now fixed with this commit, errno is reported in case of error. Fix #70
1 parent 6ce8d97 commit a22b3b3

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9393
- Static analysis errors reported by ruff tool with a simple initial
9494
configuration (#75).
9595
- Properly remove deprecated source RPM packages from repository after a
96-
successful build (#58)
96+
successful build (#58).
97+
- Compiler `-Wunused-result` warnings with binary wrappers (#70).
9798
- cli:
9899
- Avoid hazardous handling of unsupported errors, as a basis for better
99100
error management.

lib/wrappers/u-bin.c.in

+4-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ int main(int argc, char **argv) {
3535

3636
if (fork() == 0) {
3737
/* Become root before executing the command */
38-
setuid(0);
39-
setgid(0);
38+
if(setuid(0))
39+
perror("setuid");
40+
if(setgid(0))
41+
perror("setgid");
4042
if(execv(nargv[0], nargv))
4143
perror("execv");
4244
/* Exit code 255 if execve() fails */

0 commit comments

Comments
 (0)