mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
Make all fopen() calls use O_CLOEXEC
by adding "e" to the mode strings.
This commit is contained in:
parent
400860f63c
commit
bb4f274ae0
10 changed files with 23 additions and 23 deletions
|
|
@ -835,7 +835,7 @@ static int init_pipes(int read_fds[_FD_LAST], int write_fds[_FD_LAST])
|
|||
#ifdef __linux__
|
||||
{
|
||||
FILE *f;
|
||||
f = fopen("/proc/sys/fs/pipe-max-size", "r");
|
||||
f = fopen("/proc/sys/fs/pipe-max-size", "re");
|
||||
if (f) {
|
||||
if (fscanf(f, "%d", &r) == 1)
|
||||
pipe_max_size = SPA_MIN(r, pipe_max_size);
|
||||
|
|
@ -1244,7 +1244,7 @@ static char* make_xdg_runtime_dir(void)
|
|||
/* Marker file to avoid removing a random directory during cleanup */
|
||||
r = spa_scnprintf(path, sizeof(path), "%s/pwtest.dir", dir);
|
||||
spa_assert_se((size_t)r == strlen(dir) + 11);
|
||||
fp = fopen(path, "w");
|
||||
fp = fopen(path, "we");
|
||||
spa_assert_se(fp);
|
||||
fprintf(fp, "pwtest\n");
|
||||
fclose(fp);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ PWTEST(config_load_abspath)
|
|||
char *basename;
|
||||
|
||||
pwtest_mkstemp(path);
|
||||
fp = fopen(path, "w");
|
||||
fp = fopen(path, "we");
|
||||
fputs("data = x", fp);
|
||||
fclose(fp);
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ PWTEST(logger_truncate_long_lines)
|
|||
/* Print a line expected to be truncated */
|
||||
spa_log_error(iface, "MARK: %1100s", "foo");
|
||||
|
||||
fp = fopen(fname, "r");
|
||||
fp = fopen(fname, "re");
|
||||
while (fgets(buffer, sizeof(buffer), fp) != NULL) {
|
||||
if (strstr(buffer, "MARK:")) {
|
||||
const char *suffix = ".. (truncated)\n";
|
||||
|
|
@ -110,7 +110,7 @@ PWTEST(logger_no_ansi)
|
|||
* tty so expect none despite colors being enabled */
|
||||
spa_log_error(iface, "MARK\n");
|
||||
|
||||
fp = fopen(fname, "r");
|
||||
fp = fopen(fname, "re");
|
||||
while (fgets(buffer, sizeof(buffer), fp) != NULL) {
|
||||
if (strstr(buffer, "MARK")) {
|
||||
mark_line_found = true;
|
||||
|
|
@ -157,7 +157,7 @@ test_log_levels(enum spa_log_level level)
|
|||
if (level < SPA_LOG_LEVEL_TRACE)
|
||||
pw_log(level + 1, "ABOVE");
|
||||
|
||||
fp = fopen(fname, "r");
|
||||
fp = fopen(fname, "re");
|
||||
while (fgets(buffer, sizeof(buffer), fp) != NULL) {
|
||||
if (strstr(buffer, "CURRENT"))
|
||||
current_level_found = true;
|
||||
|
|
@ -427,7 +427,7 @@ PWTEST(logger_topics)
|
|||
|
||||
spa_logt_info(iface, &topic, "MARK\n");
|
||||
|
||||
fp = fopen(fname, "r");
|
||||
fp = fopen(fname, "re");
|
||||
while (fgets(buffer, sizeof(buffer), fp) != NULL) {
|
||||
if (strstr(buffer, "MARK")) {
|
||||
mark_line_found = true;
|
||||
|
|
@ -602,7 +602,7 @@ PWTEST(logger_journal_chain)
|
|||
/* Now check that the line is in the chained file logger too */
|
||||
spa_memzero(buffer, sizeof(buffer));
|
||||
mark_line_found = false;
|
||||
fp = fopen(fname, "r");
|
||||
fp = fopen(fname, "re");
|
||||
while (fgets(buffer, sizeof(buffer), fp) != NULL) {
|
||||
if (strstr(buffer, token)) {
|
||||
mark_line_found = true;
|
||||
|
|
|
|||
|
|
@ -484,7 +484,7 @@ PWTEST(properties_serialize_dict_stack_overflow)
|
|||
dict = SPA_DICT_INIT(items, 2);
|
||||
|
||||
pwtest_mkstemp(tmpfile);
|
||||
fp = fopen(tmpfile, "w");
|
||||
fp = fopen(tmpfile, "we");
|
||||
pwtest_ptr_notnull(fp);
|
||||
r = pw_properties_serialize_dict(fp, &dict, 0);
|
||||
pwtest_int_eq(r, 1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue