This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree:
Subject: v4l2-ctl: check the fopen() result. Author: Hans Verkuil <hans.verk...@cisco.com> Date: Wed Jul 11 12:15:46 2018 +0200 The result of fopen() for file_in and file_from was never checked. Show an error if the file couldn't be opened. Signed-off-by: Hans Verkuil <hans.verk...@cisco.com> utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=e4df0e3cd3a84570714defe279d13eae894cb1fa diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp index 078678ff29d6..06a2d7f3c342 100644 --- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp @@ -1172,6 +1172,10 @@ recover: fout = stdout; else fout = fopen(file_to, "w+"); + if (!fout) { + fprintf(stderr, "could not open %s for writing\n", file_to); + return; + } } else if (host_to) { char *p = strchr(host_to, ':'); struct sockaddr_in serv_addr; @@ -1349,6 +1353,10 @@ static void streaming_set_out(cv4l_fd &fd) fin = stdin; else fin = fopen(file_from, "r"); + if (!fin) { + fprintf(stderr, "could not open %s for reading\n", file_from); + return; + } } else if (host_from) { char *p = strchr(host_from, ':'); int listen_fd; @@ -1578,6 +1586,10 @@ static void streaming_set_m2m(cv4l_fd &fd) file[CAP] = stdout; else file[CAP] = fopen(file_to, "w+"); + if (!file[CAP]) { + fprintf(stderr, "could not open %s for writing\n", file_to); + return; + } } if (file_from) { @@ -1585,6 +1597,10 @@ static void streaming_set_m2m(cv4l_fd &fd) file[OUT] = stdin; else file[OUT] = fopen(file_from, "r"); + if (!file[OUT]) { + fprintf(stderr, "could not open %s for reading\n", file_from); + return; + } } if (in.reqbufs(&fd, reqbufs_count_cap) || @@ -1765,6 +1781,10 @@ static void streaming_set_cap2out(cv4l_fd &fd, cv4l_fd &out_fd) file[CAP] = stdout; else file[CAP] = fopen(file_to, "w+"); + if (!file[CAP]) { + fprintf(stderr, "could not open %s for writing\n", file_to); + return; + } } if (file_from) { @@ -1772,6 +1792,10 @@ static void streaming_set_cap2out(cv4l_fd &fd, cv4l_fd &out_fd) file[OUT] = stdin; else file[OUT] = fopen(file_from, "r"); + if (!file[OUT]) { + fprintf(stderr, "could not open %s for reading\n", file_from); + return; + } } if (in.reqbufs(&fd, reqbufs_count_cap) || _______________________________________________ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits