sailfishos-patches / patchmanager

Patchmanager for SailfishOS
https://openrepos.net/content/patchmanager/patchmanager
Other
21 stars 22 forks source link

Three compile warnings in the same C source file #325

Closed Olf0 closed 1 year ago

Olf0 commented 1 year ago

PATCHMANAGER VERSION: 3.2.4

BUG DESCRIPTION

Three warnings in the same C source file caught my eye, while watching a GitHub CI run:

make[2]: Entering directory '/home/nemo/build/src/preload'
gcc -c -pipe -std=c11 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -march=armv8-a -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_PLUGIN -I. -isystem /usr/include/libshadowutils -I/usr/share/qt5/mkspecs/linux-g++ -o preloadpatchmanager.o src/preloadpatchmanager.c
src/preloadpatchmanager.c: In function 'pm_validate_uid':
src/preloadpatchmanager.c:104:34: warning: unused parameter 'uid' [-Wunused-parameter]
 static int pm_validate_uid(uid_t uid)
                            ~~~~~~^~~
/usr/include/bits/fcntl2.h: In function 'open':
src/preloadpatchmanager.c:212:5: warning: ignoring return value of 'realpath', declared with attribute warn_unused_result [-Wunused-result]
     realpath(pathname, new_name);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/bits/fcntl2.h: In function 'open64':
src/preloadpatchmanager.c:168:5: warning: ignoring return value of 'realpath', declared with attribute warn_unused_result [-Wunused-result]
     realpath(pathname, new_name);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
At top level:
src/preloadpatchmanager.c:99:14: warning: 'user_uid' defined but not used [-Wunused-function]
 static uid_t user_uid()
              ^~~~~~~~
rm -f libpreloadpatchmanager.so
g++ -Wl,-O1 -shared -o libpreloadpatchmanager.so preloadpatchmanager.o  -ldl -lshadowutils -lpthread  
make[2]: Leaving directory '/home/nemo/build/src/preload'

See e.g, the the section from line 150 to line 170 of this CI run.

STEPS TO REPRODUCE

Build Patchmanager 3.

PRELIMINARY ASSESSMENT

I do not believe this is critical, but should be looked after as a janitorial measure. And sometimes such seemingly harmless warnings indicate a real flaw when investigating.

Olf0 commented 1 year ago

MR #328 fixes this issue.

b100dian commented 1 year ago

PR #329 should make it permanent ;)