| 1 | /* |
| 2 | * Copyright © 2018 Red Hat, Inc |
| 3 | * Copyright © 2024 GNOME Foundation Inc. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU Lesser General Public |
| 7 | * License as published by the Free Software Foundation; either |
| 8 | * version 2.1 of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This library is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * Lesser General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU Lesser General Public |
| 16 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 17 | * |
| 18 | * Authors: |
| 19 | * Matthias Clasen <[email protected]> |
| 20 | * Julian Sparber <[email protected]> |
| 21 | */ |
| 22 | |
| 23 | /* This is based on src/validate-icon.c */ |
| 24 | |
| 25 | #include <errno.h> |
| 26 | #include <fcntl.h> |
| 27 | #include <unistd.h> |
| 28 | |
| 29 | #include <glib/gstdio.h> |
| 30 | /* The gst headers currently contain a non-exhaustive switch */ |
| 31 | #pragma GCC diagnostic push |
| 32 | #pragma GCC diagnostic ignored "-Wswitch-enum" |
| 33 | #include <gst/gst.h> |
| 34 | #include <gst/pbutils/pbutils.h> |
| 35 | #pragma GCC diagnostic pop |
| 36 | |
| 37 | #ifdef __FreeBSD__ |
| 38 | #define execvpe exect |
| 39 | #endif |
| 40 | |
| 41 | #define SOUND_VALIDATOR_GROUPcxx . . $ `src/validate-sound.c:41:9`! "Sound Validator" |
| 42 | |
| 43 | static int |
| 44 | validate_soundcxx . . $ validate_sound(7864480464b09eea). (int input_fd) |
| 45 | { |
| 46 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GKeyFile) key_file = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 47 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *key_file_data = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 48 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 49 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GstDiscoverer) discoverer = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 50 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GstDiscovererInfo) info = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 51 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GstDiscovererStreamInfo) audio_info = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 52 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GstDiscovererStreamInfo) stream_info = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 53 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GstDiscovererStreamInfo) stream_next = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 54 | GstDiscovererResultcxx . . $ GstDiscovererResult# result; |
| 55 | const gcharcxx . . $ gchar# *format = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 56 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! gcharcxx . . $ gchar# *uri = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 57 | |
| 58 | gst_initcxx . . $ gst_init(49aaaae07c8bf5c4). (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 59 | |
| 60 | discoverer = gst_discoverer_newcxx . . $ gst_discoverer_new(b7f25ea108b972a). (GST_SECONDcxx . . $ `<external>/3702184213503130145/gstclock.h:103:9`!, &error); |
| 61 | |
| 62 | if (!discoverer) |
| 63 | { |
| 64 | g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("validate-sound: Failed to create gstreamer discoverer: %s\n", error->messagecxx . . $ _GError#message.); |
| 65 | return 1; |
| 66 | } |
| 67 | |
| 68 | uri = g_strdup_printfcxx . . $ g_strdup_printf(a849077ff1b8d812). ("file:///proc/self/fd/%d", input_fd); |
| 69 | info = gst_discoverer_discover_uricxx . . $ gst_discoverer_discover_uri(98b6f2a378038219). (discoverer, uri, &error); |
| 70 | result = gst_discoverer_info_get_resultcxx . . $ gst_discoverer_info_get_result(f3e59416789bacc5). (info); |
| 71 | |
| 72 | switch (result) |
| 73 | { |
| 74 | case GST_DISCOVERER_URI_INVALIDcxx . . $ GST_DISCOVERER_URI_INVALID.: |
| 75 | g_assert_not_reachedcxx . . $ `<external>/15287032793271088244/gtestutils.h:274:9`! (); |
| 76 | return 1; |
| 77 | case GST_DISCOVERER_ERRORcxx . . $ GST_DISCOVERER_ERROR.: |
| 78 | g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("validate-sound: Couldn't discover media type: %s\n", error->messagecxx . . $ _GError#message.); |
| 79 | return 1; |
| 80 | case GST_DISCOVERER_TIMEOUTcxx . . $ GST_DISCOVERER_TIMEOUT.: |
| 81 | g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("validate-sound: Couldn't discover media type: Timeout\n"); |
| 82 | return 1; |
| 83 | case GST_DISCOVERER_BUSYcxx . . $ GST_DISCOVERER_BUSY.: |
| 84 | g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("validate-sound: Couldn't discover media type: Busy\n"); |
| 85 | return 1; |
| 86 | case GST_DISCOVERER_MISSING_PLUGINScxx . . $ GST_DISCOVERER_MISSING_PLUGINS.: |
| 87 | { |
| 88 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *str = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 89 | |
| 90 | str = g_strjoinvcxx . . $ g_strjoinv(3bdede71480c687a). ("\n", |
| 91 | (char **) gst_discoverer_info_get_missing_elements_installer_detailscxx . . $ gst_discoverer_info_get_missing_elements_installer_details(af349c9f3ea70cc7). (info)); |
| 92 | |
| 93 | g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("validate-sound: Couldn't discover media type: Missing plugins: %s\n", str); |
| 94 | return 1; |
| 95 | } |
| 96 | case GST_DISCOVERER_OKcxx . . $ GST_DISCOVERER_OK.: |
| 97 | break; |
| 98 | } |
| 99 | |
| 100 | stream_info = gst_discoverer_info_get_stream_infocxx . . $ gst_discoverer_info_get_stream_info(d66893dff2f671f). (info); |
| 101 | if (!stream_info) |
| 102 | { |
| 103 | g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("validate-sound: Contains a invalid stream\n"); |
| 104 | return 1; |
| 105 | } |
| 106 | |
| 107 | stream_next = gst_discoverer_stream_info_get_nextcxx . . $ gst_discoverer_stream_info_get_next(3efa1af951ec1519). (stream_info); |
| 108 | if (stream_next) |
| 109 | { |
| 110 | g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("validate-sound: Only a single stream is allowed\n"); |
| 111 | return 1; |
| 112 | } |
| 113 | |
| 114 | if (GST_IS_DISCOVERER_CONTAINER_INFOcxx . . $ `<external>/8989778625990710708/gstdiscoverer.h:99:9`! (stream_info)) |
| 115 | { |
| 116 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GList) streams = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 117 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GstCaps) container_caps = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 118 | GstStructurecxx . . $ GstStructure# *structure = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 119 | |
| 120 | container_caps = gst_discoverer_stream_info_get_capscxx . . $ gst_discoverer_stream_info_get_caps(41c52a77a1e96893). (stream_info); |
| 121 | structure = gst_caps_get_structurecxx . . $ gst_caps_get_structure(7bef9a7c814fa85d). (container_caps, 0); |
| 122 | |
| 123 | if (!gst_caps_is_fixedcxx . . $ gst_caps_is_fixed(53fdb5cb7412f113). (container_caps) || gst_caps_get_sizecxx . . $ gst_caps_get_size(ebfaf08f43e5a7fa). (container_caps) != 1) |
| 124 | { |
| 125 | g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("validate-sound: The media format is to complex\n"); |
| 126 | return 1; |
| 127 | } |
| 128 | |
| 129 | if (!gst_structure_has_namecxx . . $ gst_structure_has_name(c98256ceb658c9b4). (structure, "audio/ogg")) |
| 130 | { |
| 131 | g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("validate-sound: Unsupported container format\n"); |
| 132 | return 1; |
| 133 | } |
| 134 | |
| 135 | streams = gst_discoverer_container_info_get_streamscxx . . $ gst_discoverer_container_info_get_streams(b01130eb53cf2406). (GST_DISCOVERER_CONTAINER_INFOcxx . . $ `<external>/8989778625990710708/gstdiscoverer.h:97:9`! (stream_info)); |
| 136 | |
| 137 | if (streams->nextcxx . . $ _GList#next.) |
| 138 | { |
| 139 | g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("validate-sound: Only a single stream is allowed\n"); |
| 140 | return 1; |
| 141 | } |
| 142 | |
| 143 | audio_info = gst_discoverer_stream_info_refcxx . . $ `<external>/8989778625990710708/gstdiscoverer.h:60:9`! (streams->data); |
| 144 | } |
| 145 | else |
| 146 | { |
| 147 | audio_info = g_steal_pointercxx . . $ `<external>/1123956534522462559/gmem.h:250:9`! (&stream_info); |
| 148 | } |
| 149 | |
| 150 | if (GST_IS_DISCOVERER_AUDIO_INFOcxx . . $ `<external>/8989778625990710708/gstdiscoverer.h:123:9`! (audio_info)) |
| 151 | { |
| 152 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GstCaps) caps = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 153 | GstStructurecxx . . $ GstStructure# *structure = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 154 | |
| 155 | caps = gst_discoverer_stream_info_get_capscxx . . $ gst_discoverer_stream_info_get_caps(41c52a77a1e96893). (audio_info); |
| 156 | structure = gst_caps_get_structurecxx . . $ gst_caps_get_structure(7bef9a7c814fa85d). (caps, 0); |
| 157 | |
| 158 | if (!gst_caps_is_fixedcxx . . $ gst_caps_is_fixed(53fdb5cb7412f113). (caps) || gst_caps_get_sizecxx . . $ gst_caps_get_size(ebfaf08f43e5a7fa). (caps) != 1) |
| 159 | { |
| 160 | g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("validate-sound: Media format is to complex\n"); |
| 161 | return 1; |
| 162 | } |
| 163 | |
| 164 | if (gst_structure_has_namecxx . . $ gst_structure_has_name(c98256ceb658c9b4). (structure, "audio/x-wav")) |
| 165 | { |
| 166 | format = "wav/pcm"; |
| 167 | } |
| 168 | else if (gst_structure_has_namecxx . . $ gst_structure_has_name(c98256ceb658c9b4). (gst_caps_get_structurecxx . . $ gst_caps_get_structure(7bef9a7c814fa85d). (caps, 0), "audio/x-vorbis")) |
| 169 | { |
| 170 | format = "ogg/vorbis"; |
| 171 | } |
| 172 | else if (gst_structure_has_namecxx . . $ gst_structure_has_name(c98256ceb658c9b4). (gst_caps_get_structurecxx . . $ gst_caps_get_structure(7bef9a7c814fa85d). (caps, 0), "audio/x-opus")) |
| 173 | { |
| 174 | format = "ogg/opus"; |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | if (format == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 179 | { |
| 180 | g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("validate-sound: Unsupported sound format\n"); |
| 181 | return 1; |
| 182 | } |
| 183 | |
| 184 | key_file = g_key_file_newcxx . . $ g_key_file_new(9306a185df8cc356). (); |
| 185 | g_key_file_set_stringcxx . . $ g_key_file_set_string(c55395ecd37921cb). (key_file, SOUND_VALIDATOR_GROUPcxx . . $ `src/validate-sound.c:41:9`!, "format", format); |
| 186 | key_file_data = g_key_file_to_datacxx . . $ g_key_file_to_data(a45dc388ad4c0686). (key_file, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 187 | g_printcxx . . $ g_print(326aeb464d16410c). ("%s", key_file_data); |
| 188 | |
| 189 | closecxx . . $ close(7864480464b09eea). (input_fd); |
| 190 | |
| 191 | return 0; |
| 192 | } |
| 193 | |
| 194 | #ifdef HELPERcxx . . $ `<built-in>:416:9`! |
| 195 | |
| 196 | G_GNUC_NULL_TERMINATEDcxx . . $ `<external>/12741050725406041920/gmacros.h:330:9`! |
| 197 | static void |
| 198 | add_argscxx . . $ add_args(aa30f7e23b4ff587). (GPtrArraycxx . . $ GPtrArray# *argv_array, ...) |
| 199 | { |
| 200 | va_listcxx . . $ va_list# args; |
| 201 | const char *arg; |
| 202 | |
| 203 | va_startcxx . . $ `<external>/8105065126723003039/stdarg.h:50:9`! (args, argv_array); |
| 204 | while ((arg = va_argcxx . . $ `<external>/8105065126723003039/stdarg.h:53:9`! (args, const gchar *))) |
| 205 | g_ptr_array_addcxx . . $ g_ptr_array_add(3cd73f70a4ada9). (argv_array, g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (arg)); |
| 206 | va_endcxx . . $ `<external>/8105065126723003039/stdarg.h:52:9`! (args); |
| 207 | } |
| 208 | |
| 209 | static gbooleancxx . . $ gboolean# |
| 210 | path_is_usrmergedcxx . . $ path_is_usrmerged(5c4306d8553b3696). (const char *dir) |
| 211 | { |
| 212 | /* does /dir point to /usr/dir? */ |
| 213 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *target = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 214 | GStatBufcxx . . $ GStatBuf# stat_buf_src, stat_buf_target; |
| 215 | |
| 216 | if (g_statcxx . . $ `<external>/6704587548159124736/gstdio.h:77:9`! (dir, &stat_buf_src) < 0) |
| 217 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 218 | |
| 219 | target = g_strdup_printfcxx . . $ g_strdup_printf(a849077ff1b8d812). ("/usr/%s", dir); |
| 220 | |
| 221 | if (g_statcxx . . $ `<external>/6704587548159124736/gstdio.h:77:9`! (target, &stat_buf_target) < 0) |
| 222 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 223 | |
| 224 | return (stat_buf_src.st_devcxx . . $ stat#st_dev. == stat_buf_target.st_devcxx . . $ stat#st_dev.) && |
| 225 | (stat_buf_src.st_inocxx . . $ stat#st_ino. == stat_buf_target.st_inocxx . . $ stat#st_ino.); |
| 226 | } |
| 227 | |
| 228 | const char * |
| 229 | flatpak_get_bwrapcxx . . $ flatpak_get_bwrap(33a1f659e94feb42). (void) |
| 230 | { |
| 231 | const char *e = g_getenvcxx . . $ g_getenv(fb58d2e09a2a1ce6). ("FLATPAK_BWRAP"); |
| 232 | |
| 233 | if (e != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 234 | return e; |
| 235 | |
| 236 | return HELPERcxx . . $ `<built-in>:416:9`!; |
| 237 | } |
| 238 | |
| 239 | static int |
| 240 | rerun_in_sandboxcxx . . $ rerun_in_sandbox(7864480464b09eea). (int input_fd) |
| 241 | { |
| 242 | const char * const usrmerged_dirs[] = { "bin", "lib32", "lib64", "lib", "sbin" }; |
| 243 | int i; |
| 244 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GPtrArray) args = g_ptr_array_new_with_free_funccxx . . $ g_ptr_array_new_with_free_func(e90788d6907589f2). (g_freecxx . . $ g_free(5d22bdacc48458e8).); |
| 245 | char validate_sound[PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`! + 1]; |
| 246 | ssize_tcxx . . $ ssize_t# symlink_size; |
| 247 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char* arg_input_fd = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 248 | |
| 249 | symlink_size = readlinkcxx . . $ readlink(373c9bd46766ee5). ("/proc/self/exe", validate_sound, sizeof (validate_sound) - 1); |
| 250 | if (symlink_size < 0 || (size_t) symlink_size >= sizeof (validate_sound)) |
| 251 | { |
| 252 | g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("Error: failed to read /proc/self/exe\n"); |
| 253 | return 1; |
| 254 | } |
| 255 | |
| 256 | validate_sound[symlink_size] = 0; |
| 257 | |
| 258 | add_argscxx . . $ add_args(aa30f7e23b4ff587). (args, |
| 259 | flatpak_get_bwrapcxx . . $ flatpak_get_bwrap(33a1f659e94feb42). (), |
| 260 | "--unshare-ipc", |
| 261 | "--unshare-net", |
| 262 | "--unshare-pid", |
| 263 | "--tmpfs", "/tmp", |
| 264 | "--proc", "/proc", |
| 265 | "--dev", "/dev", |
| 266 | "--ro-bind", "/usr", "/usr", |
| 267 | "--ro-bind-try", "/etc/ld.so.cache", "/etc/ld.so.cache", |
| 268 | "--ro-bind", validate_sound, validate_sound, |
| 269 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 270 | |
| 271 | /* These directories might be symlinks into /usr/... */ |
| 272 | for (i = 0; i < G_N_ELEMENTScxx . . $ `<external>/12741050725406041920/gmacros.h:993:9`! (usrmerged_dirs); i++) |
| 273 | { |
| 274 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *absolute_dir = g_strdup_printfcxx . . $ g_strdup_printf(a849077ff1b8d812). ("/%s", usrmerged_dirs[i]); |
| 275 | |
| 276 | if (!g_file_testcxx . . $ g_file_test(d991f72152d535bf). (absolute_dir, G_FILE_TEST_EXISTScxx . . $ G_FILE_TEST_EXISTS.)) |
| 277 | continue; |
| 278 | |
| 279 | if (path_is_usrmergedcxx . . $ path_is_usrmerged(5c4306d8553b3696). (absolute_dir)) |
| 280 | { |
| 281 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *symlink_target = g_strdup_printfcxx . . $ g_strdup_printf(a849077ff1b8d812). ("/usr/%s", absolute_dir); |
| 282 | |
| 283 | add_argscxx . . $ add_args(aa30f7e23b4ff587). (args, |
| 284 | "--symlink", symlink_target, absolute_dir, |
| 285 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 286 | } |
| 287 | else |
| 288 | { |
| 289 | add_argscxx . . $ add_args(aa30f7e23b4ff587). (args, |
| 290 | "--ro-bind", absolute_dir, absolute_dir, |
| 291 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | add_argscxx . . $ add_args(aa30f7e23b4ff587). (args, |
| 296 | "--chdir", "/", |
| 297 | "--setenv", "GIO_USE_VFS", "local", |
| 298 | "--unsetenv", "TMPDIR", |
| 299 | "--die-with-parent", |
| 300 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 301 | |
| 302 | if (g_getenvcxx . . $ g_getenv(fb58d2e09a2a1ce6). ("G_MESSAGES_DEBUG")) |
| 303 | add_argscxx . . $ add_args(aa30f7e23b4ff587). (args, "--setenv", "G_MESSAGES_DEBUG", g_getenvcxx . . $ g_getenv(fb58d2e09a2a1ce6). ("G_MESSAGES_DEBUG"), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 304 | if (g_getenvcxx . . $ g_getenv(fb58d2e09a2a1ce6). ("G_MESSAGES_PREFIXED")) |
| 305 | add_argscxx . . $ add_args(aa30f7e23b4ff587). (args, "--setenv", "G_MESSAGES_PREFIXED", g_getenvcxx . . $ g_getenv(fb58d2e09a2a1ce6). ("G_MESSAGES_PREFIXED"), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 306 | |
| 307 | |
| 308 | arg_input_fd = g_strdup_printfcxx . . $ g_strdup_printf(a849077ff1b8d812). ("%d", input_fd); |
| 309 | add_argscxx . . $ add_args(aa30f7e23b4ff587). (args, validate_sound, "--fd", arg_input_fd, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 310 | g_ptr_array_addcxx . . $ g_ptr_array_add(3cd73f70a4ada9). (args, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 311 | |
| 312 | execvpecxx . . $ execvpe(181eaca3a689d655). (flatpak_get_bwrapcxx . . $ flatpak_get_bwrap(33a1f659e94feb42). (), (char **) args->pdatacxx . . $ _GPtrArray#pdata., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 313 | /* If we get here, then execvpe() failed. */ |
| 314 | g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("Sound validation: execvpe %s: %s\n", flatpak_get_bwrapcxx . . $ flatpak_get_bwrap(33a1f659e94feb42). (), g_strerrorcxx . . $ g_strerror(f7ae7e56280f18ae). (errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 315 | return 1; |
| 316 | } |
| 317 | #endif |
| 318 | |
| 319 | static gbooleancxx . . $ gboolean# opt_sandboxcxx . . $ opt_sandbox.; |
| 320 | static gcharcxx . . $ gchar# *opt_pathcxx . . $ opt_path. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 321 | static gintcxx . . $ gint# opt_fdcxx . . $ opt_fd. = -1; |
| 322 | |
| 323 | static GOptionEntrycxx . . $ GOptionEntry# entriescxx . . $ entries.[] = { |
| 324 | { "sandbox", 0, 0, G_OPTION_ARG_NONEcxx . . $ G_OPTION_ARG_NONE., &opt_sandboxcxx . . $ opt_sandbox., "Run in a sandbox", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! }, |
| 325 | { "path", 0, 0, G_OPTION_ARG_FILENAMEcxx . . $ G_OPTION_ARG_FILENAME., &opt_pathcxx . . $ opt_path., "Read sound data from given file path", "PATH" }, |
| 326 | { "fd", 0, 0, G_OPTION_ARG_INTcxx . . $ G_OPTION_ARG_INT., &opt_fdcxx . . $ opt_fd., "Read sound data from given file descriptor", "FD" }, |
| 327 | { NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! } |
| 328 | }; |
| 329 | |
| 330 | int |
| 331 | maincxx . . $ main(afcd3168fc1188a4). (int argc, char *argv[]) |
| 332 | { |
| 333 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GOptionContext) context = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 334 | g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 335 | |
| 336 | g_log_writer_default_set_use_stderrcxx . . $ g_log_writer_default_set_use_stderr(d4f767463ce0a6b3). (TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!); |
| 337 | |
| 338 | context = g_option_context_newcxx . . $ g_option_context_new(a696d53710071c45). (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 339 | g_option_context_add_main_entriescxx . . $ g_option_context_add_main_entries(2b8a7b3623c14603). (context, entriescxx . . $ entries., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 340 | if (!g_option_context_parsecxx . . $ g_option_context_parse(e19b3ba917830101). (context, &argc, &argv, &error)) |
| 341 | { |
| 342 | g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("Error: %s\n", error->messagecxx . . $ _GError#message.); |
| 343 | return 1; |
| 344 | } |
| 345 | |
| 346 | if (opt_pathcxx . . $ opt_path. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && opt_fdcxx . . $ opt_fd. != -1) |
| 347 | { |
| 348 | g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("Error: Only --path or --fd can be given\n"); |
| 349 | return 1; |
| 350 | } |
| 351 | |
| 352 | if (opt_pathcxx . . $ opt_path.) |
| 353 | { |
| 354 | opt_fdcxx . . $ opt_fd. = g_opencxx . . $ `<external>/6704587548159124736/gstdio.h:73:9`! (opt_pathcxx . . $ opt_path., O_RDONLYcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:43:9`!, 0); |
| 355 | if (opt_fdcxx . . $ opt_fd. == -1) |
| 356 | { |
| 357 | g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("Error: Couldn't open file\n"); |
| 358 | return 1; |
| 359 | } |
| 360 | } |
| 361 | else if (opt_fdcxx . . $ opt_fd. == -1) |
| 362 | { |
| 363 | g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *help = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 364 | |
| 365 | help = g_option_context_get_helpcxx . . $ g_option_context_get_help(ff6b251d7c5b0c51). (context, TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 366 | g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("Error: Either --path or --fd needs to be given\n\n%s", help); |
| 367 | return 1; |
| 368 | } |
| 369 | |
| 370 | #ifdef HELPERcxx . . $ `<built-in>:416:9`! |
| 371 | if (opt_sandboxcxx . . $ opt_sandbox.) |
| 372 | return rerun_in_sandboxcxx . . $ rerun_in_sandbox(7864480464b09eea). (opt_fdcxx . . $ opt_fd.); |
| 373 | else |
| 374 | #endif |
| 375 | return validate_soundcxx . . $ validate_sound(7864480464b09eea). (opt_fdcxx . . $ opt_fd.); |
| 376 | } |