* mark python sqlite DEP opt and update .cache
[t2sde.git] / package / audio / cdparanoia / no-cuserid.patch.musl
blob5252456ddd5de4bbc4ad08e60baa63e61cdddcb9
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: package/*/cdparanoia/no-cuserid.patch.musl
3 # Copyright (C) 2022 The T2 SDE Project
4
5 # This Copyright note is generated by scripts/Create-CopyPatch,
6 # more information can be found in the files COPYING and README.
7
8 # This patch file is dual-licensed. It is available under the license the
9 # patched project is licensed under, as long as it is an OpenSource license
10 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
11 # of the GNU General Public License version 2 as used by the T2 SDE.
12 # --- T2-COPYRIGHT-NOTE-END ---
14 Since IEEE 1003.1-1988 cuserid is not standardized anymore. The musl
15 libc, used by Alpine Linux, currently does not supporting using it with
16 a NULL pointer argument [1]. Doing so causes a segmentation fault, to
17 fix this remove use of cuserid entirely. This is currently achieved by
18 not including the user name in the error message, while it would be
19 possible to achieve the same output using getpwuid(geteuid()) this
20 requires error handling and would make the patch more complicated.
22 [1]: https://www.openwall.com/lists/musl/2020/01/29/2
24 diff -upr cdparanoia-III-10.2.orig/interface/scan_devices.c cdparanoia-III-10.2/interface/scan_devices.c
25 --- cdparanoia-III-10.2.orig/interface/scan_devices.c   2020-02-12 20:29:46.232958848 +0100
26 +++ cdparanoia-III-10.2/interface/scan_devices.c        2020-02-12 20:30:06.336297868 +0100
27 @@ -6,8 +6,6 @@
28   * 
29   ******************************************************************/
31 -#define _GNU_SOURCE /* get cuserid */
32 -#define _USE_XOPEN /* get cuserid */
33  #include <limits.h>
34  #include <stdio.h>
35  #include <unistd.h>
36 @@ -93,8 +91,7 @@ cdrom_drive *cdda_find_a_cdrom(int messa
37      i++;
38    }
39    idmessage(messagedest,messages,
40 -           "\n\nNo cdrom drives accessible to %s found.\n",
41 -           cuserid(NULL));
42 +           "\n\nNo cdrom drives accessible to current user found.\n", NULL);
43    return(NULL);
44  }