forked from pool/bzip2
e8b7e041b9
- bzlib: open file descriptors with O_CLOEXEC, but just like the zlib case, only when bzopen() is used and not bzdopen() to avoid messing up with the caller's semantics. It is responsability of to initiator to set that flag in such case. - Replace error prone list of exported symbols with proper use of GCC visibility features. OBS-URL: https://build.opensuse.org/request/show/99345 OBS-URL: https://build.opensuse.org/package/show/Archiving/bzip2?expand=0&rev=26
20 lines
473 B
Diff
20 lines
473 B
Diff
--- bzlib.c.orig
|
|
+++ bzlib.c
|
|
@@ -1414,7 +1414,15 @@ BZFILE * bzopen_or_bzdopen
|
|
}
|
|
mode++;
|
|
}
|
|
- strcat(mode2, writing ? "w" : "r" );
|
|
+
|
|
+ /* open fds with O_CLOEXEC _only_ when we are the initiator
|
|
+ * aka. bzopen() but not bzdopen() */
|
|
+ if(open_mode == 0) {
|
|
+ strcat (mode2, writing ? "we" : "re" );
|
|
+ } else {
|
|
+ strcat(mode2, writing ? "w" : "r" );
|
|
+ }
|
|
+
|
|
strcat(mode2,"b"); /* binary mode */
|
|
|
|
if (open_mode==0) {
|