Review Request 127415: Set the appropriate feature test macro definitions to enable building on musl libc

Wiktor W Brodlo wiktor at brodlo.net
Sun Mar 20 10:14:59 UTC 2016


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/127415/
-----------------------------------------------------------

(Updated March 20, 2016, 10:14 a.m.)


Review request for KDE Frameworks.


Changes
-------

Fixed whitespace


Repository: kdesu


Description
-------

The file kdesu_stub.c calls the following functions: putenv, unsetenv, initgroups, mkstemp, popen, pclose. Looking at the man pages, this set requires the _XOPEN_SOURCE and _BSD_SOURCE feature test macros to be defined. This patch passes these definitions to the compiler. This enables kdesu to be built against the musl libc, which is very strict about these things.


Diffs (updated)
-----

  src/CMakeLists.txt 73ff883 

Diff: https://git.reviewboard.kde.org/r/127415/diff/


Testing
-------

Without the patch, the build fails as follows:

```
src/kdesu_stub.c: In function ‘xsetenv’:
src/kdesu_stub.c:136:5: error: implicit declaration of function ‘putenv’ [-Werror=implicit-function-declaration]
     return putenv(s); /* yes: no free()! */
     ^
src/kdesu_stub.c: In function ‘main’:
src/kdesu_stub.c:258:9: error: implicit declaration of function ‘unsetenv’ [-Werror=implicit-function-declaration]
         unsetenv("LC_ALL");
         ^
src/kdesu_stub.c:301:9: error: implicit declaration of function ‘initgroups’ [-Werror=implicit-function-declaration]
         if (initgroups(pw->pw_name, pw->pw_gid) == -1) {
         ^
src/kdesu_stub.c:331:13: error: implicit declaration of function ‘mkstemp’ [-Werror=implicit-function-declaration]
             fd2 = mkstemp(xauthority);
             ^
src/kdesu_stub.c:342:13: error: implicit declaration of function ‘popen’ [-Werror=implicit-function-declaration]
             fout = popen("xauth >/dev/null 2>&1", "w");
             ^
src/kdesu_stub.c:342:18: warning: assignment makes pointer from integer without a cast
             fout = popen("xauth >/dev/null 2>&1", "w");
                  ^
src/kdesu_stub.c:348:13: error: implicit declaration of function ‘pclose’ [-Werror=implicit-function-declaration]
             pclose(fout);
             ^
```

With the patch, the build passes and kdesu works.


Thanks,

Wiktor W Brodlo

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20160320/37b6bc34/attachment.html>


More information about the Kde-frameworks-devel mailing list