Skip to content

Commit

Permalink
osdep: fix clang warnings with _FORTIFY_SOURCE
Browse files Browse the repository at this point in the history
This fixes warnings generated for `-Wunused-result` when mpv is built
with `-O1 -D_FORTIFY_SOURCE=1` or higher on clang since read/write
functions are declared with the `warn_unused_result` attribute.
Cast to void to avoid these warnings.
  • Loading branch information
llyyr authored and sfan5 committed Oct 24, 2023
1 parent 36403e5 commit 06c26e3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion osdep/subprocess-posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ static pid_t spawn_process(const char *path, struct mp_subprocess_opts *opts,
as_execvpe(path, opts->exe, opts->args, opts->env ? opts->env : environ);

child_failed:
write(p[1], &(char){1}, 1); // shouldn't be able to fail
(void)write(p[1], &(char){1}, 1); // shouldn't be able to fail
_exit(1);
}

Expand Down
2 changes: 1 addition & 1 deletion osdep/terminal-unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ static void *terminal_thread(void *ptr)
}
if (fds[1].revents & POLLIN) {
int8_t c = -1;
read(stop_cont_pipe[0], &c, 1);
(void)read(stop_cont_pipe[0], &c, 1);
if (c == PIPE_STOP)
do_deactivate_getch2();
else if (c == PIPE_CONT)
Expand Down

0 comments on commit 06c26e3

Please sign in to comment.